L
laredotornado
Hi,
I'm using Java 6. Hoping someone can see the simple error I have
missed. I'm trying to parse a date. I have
final String formattedStr = "2012-03-01 01:30:00";
final String format = "yyyy-MM-DD HH:mm:ss";
final SimpleDateFormat sdf = new SimpleDateFormat(format);
try {
ret = sdf.parse(formattedStr);
} catch (ParseException e) {
e.printStackTrace();
}
String retStr = ret.toString();
The value of "retStr" is "Sun Jan 01 01:30:00 CST 2012". In fact, the
month of the date string is always getting converted to January, even
though above it shoudl be March. Where is my date parsing going
wrong?
Thanks, - Dave
I'm using Java 6. Hoping someone can see the simple error I have
missed. I'm trying to parse a date. I have
final String formattedStr = "2012-03-01 01:30:00";
final String format = "yyyy-MM-DD HH:mm:ss";
final SimpleDateFormat sdf = new SimpleDateFormat(format);
try {
ret = sdf.parse(formattedStr);
} catch (ParseException e) {
e.printStackTrace();
}
String retStr = ret.toString();
The value of "retStr" is "Sun Jan 01 01:30:00 CST 2012". In fact, the
month of the date string is always getting converted to January, even
though above it shoudl be March. Where is my date parsing going
wrong?
Thanks, - Dave