1

I am trying to parse dates, for example "Sat, 29 Dec 2012 04:07:09 +0100" I am using SimpleDateFormatter with format set as

new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z", Locale.getDefault());

Unfortunately I am getting

12-29 04:44:29.890: E/MainActivity(3995): Unparseable date: "Sat, 29 Dec 2012 04:07:09 +0100" (at offset 0)
12-29 04:44:29.890: E/MainActivity(3995): java.text.ParseException: Unparseable date: "Sat, 29 Dec 2012 04:07:09 +0100" (at offset 0)

Which I absolutely dont get as that parameter regular expression is copy and pasted directly from documentation http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html under Examples

Thanks!

4

1 回答 1

10

Whatever the locale returned by Locale.getDefault() is doesn't support dates formatted that way.

Changing it to Locale.US for example, will work.

于 2012-12-29T03:54:44.913 回答