The following code:
String time = "Mon May 07 00:31:29 GMT+02:00 2018";
Date parsedDate = new SimpleDateFormat("E MMM dd HH:mm:ss zXXX yyyy", Locale.GERMANY).parse(time);
throws the following exception, instead of parsing the datestring:
java.text.ParseException: Unparseable date: "Mon May 07 00:31:29 GMT+02:00 2018"
I found the format string by trying different formatter combinations on this site and the one I came up with (E MMM dd HH:mm:ss zXXX yyyy
) seems to give the right result (on the site).
However, when used in my code it throws the given exception.
Do I have a misconception about SimpleDateFormat
or is my format string wrong?