views:

78

answers:

1

I'm parsing a date which is in format EEE, dd MMM yyyy HH:mm:ss Z. One of the sample values is Thu, 02 Sep 2010 04:03:10 -0700.

This is the parsing code:

SimpleDateFormat FORMATTER = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z");
Date date = FORMATTER.parse(dateString);

This works absolutely fine if Phone Language is English but it throws parserException when language is changed to "France" or "Italian". I have even tried this:

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

or for French locale more explicit:

SimpleDateFormat FORMATTER = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.French);

But no luck.....Can someone tell me what I am doing wrong?

+1  A: 

Since "Thu" is English, you'll want to use Locale.ENGLISH to parse it.

Joachim Sauer