TimeZone broken in SimpleDateFormat in android 2.3

穿精又带淫゛_ 提交于 2019-12-06 14:37:46

There is nothing wrong with the output. You create a DateFormat-Instance which depends on the default Locale. It is not unusual that on different machines, different java-installations the default Locale vary and so the output of locale-dependent operations. In this case the default TimeZone is different, but the two outputs in your question represent the same Date, printed with the same format String MMMMM d, yyyy hh:mm:ss a z.

UPDATE: parse() in Android 2.3 will work with TimeZones like GMT+xxxx etc, but it doesn't recognize EST for example as a valid TimeZone for parsing. Android knows about EST if you use TimeZone.getTimeZone("EST").

UPDATE2:

Three-letter timezone IDs "EST", "HST", and "MST" are deprecated. Do not use them.

Both are same TimeZone just different representation

Looks like support for pattern "EEE MMM dd HH:mm:ss zzz yyyy" is also broken.

Evgueni

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!