开发者

android problem with SimpleDateFormat TimeZone

Let's开发者_运维百科 consider this code sample:

DateFormat sdf = SimpleDateFormat.getTimeInstance(SimpleDateFormat.LONG, 
                    new Locale("ru", "RU"));
                 Date date = sdf.parse("8:13:05 PDT");

When I run this code on my desktop(java 1.6) all passes well, however on android devices I get exception, I think this is due to locale TimeZone:

java.text.ParseException: Unparseable date: 8:13:05 PDT

Why?


I don't believe UNIX can parse the PDT timezone. I'm having the same issue. It can handle PST & PST8PDT, but not PDT. I believe the recommended solution is to use PST8PDT instead.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜