0

Well, I get a ParseException when executing this code:

Date date = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy").parse("Sun Dec 01 00:05:03 CET 2013");

Where is the error?

  • This is working fine on my PC with JDK 1.6.0_45 on Windows. It printed "Sat Nov 30 18:05:03 EST 2013". – peter.petrov May 15 '14 at 14:45
  • change DD to D i.e. EEE MMM d HH:mm:ss z yyyy – Harshal Patil May 15 '14 at 14:45
  • I tried it and it did not result in any exception, i parsed and printed date and it gave me `Sun Dec 01 04:35:03 IST 2013` – Sanjeev May 15 '14 at 14:46
  • 1
    As noted in the javadoc of the constructor : `Note: This constructor may not support all locales. For full coverage, use the factory methods in the DateFormat class.` Might just be the `Locale`. – Jonathan Drapeau May 15 '14 at 14:49

0 Answers0