Caldarale, Charles R schrieb am 14.12.2008 um 23:51:55 (-0600): > > > javax.servlet.ServletException: Unparseable date: "Mon Dec 15 11:39:35 > > GMT+08:00 2008" > > This is very odd; I've tried your code in a stand-alone program > without any problem:
And there is a reason for that :-) > import java.text.DateFormat; > import java.text.ParseException; > import java.text.SimpleDateFormat; > import java.util.Date; > > class TestDate { > public static void main(String[] args) throws ParseException { > DateFormat dateFormat = > new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy"); According to the API doc, this is "[...] using [...] the default date format symbols for the default locale." In your case, Chuck, this is Locale.US, so it works for you. My default locale is Locale.GERMANY, so I have to write: new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); > Date now = new Date(); > Date date = dateFormat.parse(now.toString()); The output of now.toString() on my machine is: Tue Dec 16 01:19:47 CET 2008 The date looks pretty American to me, but Java might not accept CET, which stands for Central European Time, as a valid timezone for the US locale (despite there still being US forces in Germany). > System.out.println(date.toString()); > date = dateFormat.parse("Mon Dec 15 11:39:35 GMT+08:00 2008"); > System.out.println(date.toString()); > } > } This works for me: C:\dev\Java :: more /t2 TestDate.java import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; class TestDate { public static void main(String[] args) throws ParseException { DateFormat dateFormat = new SimpleDateFormat( "EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); Date now = new Date(); System.out.println( now.toString()); Date date = dateFormat.parse( now.toString()); System.out.println( date.toString()); } } Same story in the OP's JSP, of course. Michael Ludwig --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org