[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/28549] New: SimpleDateFormat's timezone output wrong
From: |
andrew at operationaldynamics dot com |
Subject: |
[Bug classpath/28549] New: SimpleDateFormat's timezone output wrong |
Date: |
31 Jul 2006 08:32:32 -0000 |
The current parsing of TimeZones and formatting by SimpleDateFormat has some
problems. The result of SimpleDateFormat's "zzz" time zone short code
formatting string is completely wrong
The correct output should be as follows:
$ java TimeZoneBugs
For zone named: America/Montreal
SimpleDateFormat("zzz") must be a 3 [or 4] char code: EDT
For zone named: Australia/Sydney
SimpleDateFormat("zzz") must be a 3 [or 4] char code: EST
For zone named: Europe/Paris
SimpleDateFormat("zzz") must be a 3 [or 4] char code: CEST
Trying JamVM 1.4.3 and classpath 0.91, we get the following output:
$ jamvm TimeZoneBugs
For zone named: America/Montreal
SimpleDateFormat("zzz") must be a 3 [or 4] char code: Eastern Daylight Time
(CA)
For zone named: Australia/Sydney
SimpleDateFormat("zzz") must be a 3 [or 4] char code: GMT+10:00
For zone named: Europe/Paris
SimpleDateFormat("zzz") must be a 3 [or 4] char code: Central European
Daylight Time
Note that the timezone codes are a) inconsistent and b) not short!
Trying GCJ 4.1.1, the inconsistent output isn't present, but we still get
incorrect output:
$ gcj TimeZoneBugs.java -o TimeZoneBugs --main=TimeZoneBugs
$ ./TimeZoneBugs
For zone named: America/Montreal
SimpleDateFormat("zzz") must be a 3 [or 4] char code: GMT-04:00
For zone named: Australia/Sydney
SimpleDateFormat("zzz") must be a 3 [or 4] char code: GMT+10:00
For zone named: Europe/Paris
SimpleDateFormat("zzz") must be a 3 [or 4] char code: GMT+02:00
As an aside, "GMT+hh:mm" is format you can pass to the concrete implementation
of TimeZone called SimpleTimeZone which can be used for custom zones in the
rare event what you actually want isn't available from system. In classpath's
case we apparently generate these (from an import? at runtime?) but this is a
shame because SimpleTimeZone loses a lot of information (it doesn't understand
historical timezone shifts, for instance). While GMT+hh:mm is a valid (if
slightly useless) timezone name, it is NOT the correct value for the short
code.
AfC
--
Summary: SimpleDateFormat's timezone output wrong
Product: classpath
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: classpath
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: andrew at operationaldynamics dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28549
- [Bug classpath/28549] New: SimpleDateFormat's timezone output wrong,
andrew at operationaldynamics dot com <=