Need to use unix TZ timezone strings in java Timezone class

Paul Eggert eggert at CS.UCLA.EDU
Mon Jul 12 15:59:04 UTC 2004


"Olson, Arthur David (NIH/NCI)" <olsona at dc37a.nci.nih.gov> writes:

> We have an application that uses the unix timezone string formats
> "EST5EDT", "PST8PDT" etc.

Those names are supported in some Unix flavors but not all.  They do
not conform to the POSIX standard, so they're not portable across Unix
implementations.  Perhaps that is why Java didn't implement them.

> I would appreciate any help in resolving this.

It sounds like you're asking for the list of the commonly used
nonstandard names.  You can find such a list by unpacking the tz data
files and looking for lines beginning with "Link"; for example, the
"northamerica" file contains the line "Link America/New_York EST5EDT",
and that tells you that the canonical name for "EST5EDT" is
"America/New_York".  You can then adjust your application accordingly.

If you can't change the source code of the program, you might be able
to get it to work by futzing with the Java runtime (e.g., rt.jar or
ZoneInfoMappings? I'm not sure about this), but I've never done this
sort of thing and don't recommend it as it'll make your installation
nonstandard and your program nonportable.

You don't mention which versions of Java you intend to port to.  I
understand that the Java names for time zones got reorganized in Java
1.4.  So, whichever method you choose, if you need to be portable to
older Java versions you need to test it with them.



More information about the tz mailing list