I am trying to parse a date with a SimpleDateFormat and I encountered a strange behavior.
This Example prints "Sun Jan 01 19:00:32 CET 2012" on my machine:
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Locale;
public class Test {
public static void main(String[] args) throws ParseException {
System.out.println(new SimpleDateFormat("MMM dd HH:mm:ss YYYY", Locale.ENGLISH).parse("Sep 26 19:00:32 2012"));
}
}
I would expect to have "Wed Sep 26 19:00:32 CET 2012" returned instead.
Is my DateFormat String incorrect?
The year uses small caps
y:Large cap
Yis “Week year” according to javadoc.