I need to parse this string as a date:
Mon Jun 10 00:00:00 CEST 2013
Here is what I do:
SimpleDateFormat sdf = new SimpleDateFormat("ccc MMM dd HH:mm:ss z yyyy");
Date date = sdf.parse(dateString);
But I get a ParseException
:
Unparseable date: "Wed Oct 02 00:00:00 CEST 2013" (at offset 0)
Any help please?
As others have said, you need EEE
instead of ccc
- but you should also specify a locale, so that it doesn't try to parse the month and day names (and other things) using your system default locale:
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy",
Locale.US);
See more on this question at Stackoverflow