@@ -0,0 +1,1955 @@
+/*%0D%0A * DateType.java May 2007%0D%0A *%0D%0A * Copyright (C) 2007, Niall Gallagher %3Cniallg@users.sf.net%3E%0D%0A *%0D%0A * This library is free software; you can redistribute it and/or%0D%0A * modify it under the terms of the GNU Lesser General Public%0D%0A * License as published by the Free Software Foundation.%0D%0A *%0D%0A * This library is distributed in the hope that it will be useful,%0D%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0D%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the %0D%0A * GNU Lesser General Public License for more details.%0D%0A *%0D%0A * You should have received a copy of the GNU Lesser General %0D%0A * Public License along with this library; if not, write to the %0D%0A * Free Software Foundation, Inc., 59 Temple Place, Suite 330, %0D%0A * Boston, MA  02111-1307  USA%0D%0A */%0D%0A%0D%0Apackage org.simpleframework.xml.transform;%0D%0A%0D%0Aimport java.text.SimpleDateFormat;%0D%0Aimport java.text.DateFormat;%0D%0Aimport java.util.Date;%0D%0A%0D%0Aenum DateType %7B%0D%0A   %0D%0A%0D%0A   FULL(%22yyyy-MM-dd HH:mm:ss.S z%22),%0D%0A   %0D%0A   LONG(%22yyyy-MM-dd HH:mm:ss z%22),%0D%0A   %0D%0A   NORMAL(%22yyyy-MM-dd z%22),%0D%0A   %0D%0A   SHORT(%22yyyy-MM-dd%22);%0D%0A%0D%0A   private DateFormat format;%0D%0A%0D%0A   private DateType(String format) %7B%0D%0A      this.format = new SimpleDateFormat(format);         %0D%0A   %7D%0D%0A%0D%0A   public DateFormat getFormat() %7B%0D%0A      return format;         %0D%0A   %7D%0D%0A   %0D%0A   public static String getText(Date date) throws Exception %7B%0D%0A      DateFormat format = FULL.getFormat();%0D%0A      %0D%0A      return format.format(date);%0D%0A   %7D%0D%0A   %0D%0A   public static Date getDate(String text) throws Exception %7B%0D%0A      DateType type = getType(text);%0D%0A      DateFormat format = type.getFormat();%0D%0A      %0D%0A      return format.parse(text);%0D%0A   %7D%0D%0A%0D%0A   public static DateType getType(String text) %7B%0D%0A      int length = text.length();%0D%0A%0D%0A      if(length %3E 23) %7B%0D%0A         return FULL;%0D%0A      %7D%0D%0A      if(length %3E 20) %7B%0D%0A         return LONG;%0D%0A      %7D%0D%0A      if(length %3E 11) %7B%0D%0A         return NORMAL;%0D%0A      %7D%0D%0A      return SHORT;%0D%0A   %7D%0D%0A%7D 

Add a date type