TimeZone is broken in SimpleDateFormat in android 2.3

Android 2.3 was recently released last night. So naturally, I tried my application and found that there is a date formatting problem. I noticed that DateFormatter creates different formats. So do it in a simple Java program:

((SimpleDateFormat)DateFormat.getDateTimeInstance(DateFormat.LONG, 
    DateFormat.LONG)).format(new Date());

Output

December 7, 2010 11:49:40 EST

Do the same in the Android emulator and you will get

December 7, 2010 11:42:50 GMT-05: 00

Pay attention to a different time zone. Has anyone come across this issue? Is there any other formatter that I can use that is independent of the Java implementation?

EDIT: Okay, so here in more detail why I think this is broken:

Using this code:

private final DateFormat format = 
    new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");

I tried to parse the date, but the following error is thrown:

12-07 12:55:49.556: ERROR/DateDeserializer(847): Error when parsing date
    java.text.ParseException: Unparseable date: "Mon, 06 Dec 2010 17:13:35 EST"
    at java.text.DateFormat.parse(DateFormat.java:626)
    at com.currency.mobile.client.DateDeserializer
        .deserialize(DateDeserializer.java:31)
    at com.currency.mobile.client.DateDeserializer
        .deserialize(DateDeserializer.java:19)
    at org.codehaus.jackson.map.deser.SettableBeanProperty
        .deserialize(SettableBeanProperty.java:149)
+1
3

. DateFormat -Instance, Locale. , java- Locale . TimeZone , , String MMMMM d, yyyy hh:mm:ss a z.

UPDATE: parse() Android 2.3 TimeZones, , GMT+xxxx .., EST, , TimeZone . Android EST, TimeZone.getTimeZone("EST").

UPDATE2:

"EST" , "HST" "MST" . .

+1

TimeZone

+1

, "EEE MMM dd HH: mm: ss zzz yyyy".

+1

All Articles