What's wrong with the following code? It throws a ParseException with error offset 0.
final DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy");
df.parse("Thu Jan 23 14:24:47 2014");
What's wrong with the following code? It throws a ParseException with error offset 0.
final DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy");
df.parse("Thu Jan 23 14:24:47 2014");
Is your locale
"EN"
? If you use English names for the date, make sure you are using that localeSimpleDateFormat
is absolutely locale-sensitive. Certain fields, like hours and minutes, are locale-independent.Or, you can use the localization-friendly
DateFormat#getDateInstance()
factory method instead, since:Source: https://stackoverflow.com/a/5174712/2591612
If you don't specify a
Locale
to the formatter when you construct it, it uses your defaultLocale
which apparently doesn't spell days and months in English.So specify one to the formatter that does.