开发者

Simpledateformat parse issue

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 开发者_如何学Pythondoing wrong?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜