manu manu - 7 months ago 42
Java Question

SimpleDateFormat ignoring month when parsing

The following code is giving me the parsed date as "Wed Jan 13 00:00:00 EST 2010"
instead of "Wed Jun 13 00:00:00 EST 2010". Any ideas much appreciated.

SimpleDateFormat sf = new SimpleDateFormat("yyyy-mm-dd'T'HH:mm:ss");

String str = "2010-06-13T00:00:00";

Date date = sf.parse(str);

System.out.println(" Date " + date.toString());




MM means month. mm means minutes. See the documentation for SimpleDateFormat for more details of the supported date and time patterns.