When I try the following code,
public static void main(String[] args) throws ParseException{
try {
Calendar calendar = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy");
calendar.setTime(sdf.parse("Sun Feb 22 18:02:51 FET 2015"));
} catch (Exception e) {
e.printStackTrace();
}
}
I systematically get
java.text.ParseException: Unparseable date: "Sun Feb 22 18:02:51 FET 2015"
at java.text.DateFormat.parse(DateFormat.java:357)
at foo.Sample.main(LogEntry.java:131)
I realize that my issue is the FET timezone. That is a valid timezone. I have tried different things including using Locale.English
but to no avail.
My issue seems to be due to the timezone as explained here.
EDIT
The following does not work either
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
Here is another post I found but didn't help me.