Good morning! I've been working with the following bit of code for the last two hours, scouring forums, Google and the JDK 1.6 docs for any idea what is going on but can't seem to make this work. I would expect the code to output 07/25/2010 11:59:33 PM but what I get instead is 01/25/2010 11:59:33 PM .
String dateString = "07/25/2010 11:59:33 PM";
DateFormat format = new SimpleDateFormat("MM/DD/yyyy hh:mm:ss a");
Date testDate = format.parse( dateString );
System.out.println(format.format(testDate));
Thinking that it may be something to do with the JDK, I tried writing the same thing using Joda-Time and get the same results. Am I missing something with how DateFormat works?
Thanks in advance for any insight you can provide!