I'm trying to use the SimpleDateFormat class to parse a DateTime out of this string:
Mon Jan 10 2011 01:15:00 GMT+0000 (GMT Standard Time)
I tried the following format string:
String example = "Mon Jan 10 2011 01:15:00 GMT+0000 (GMT Standard Time)";
SimpleDateFormat formatter = new SimpleDateFormat("E M d y H:m:s z");
try
{
Date exampleDate = formatter.parse(example);
LOGGER.warn(exampleDate.toString());
}
catch(Exception e)
{
LOGGER.warn(e.getMessage(), e);
}
But it generates the error:
Unparseable date: "Mon Jan 10 2011 01:15:00 GMT+0000 (GMT Standard Time)"
So I tried removing the parenthesized end part of the example string:
String example = "Sun Jan 09 2011 22:00:00 GMT+0000";
But it generates the same error.
WARNING: Unparseable date: "Sun Jan 09 2011 22:00:00 GMT+0000"
java.text.ParseException: Unparseable date: "Sun Jan 09 2011 22:00:00 GMT+0000"
Any hints on how to get around this?