FW: Need to use unix TZ timezone strings in java Timezone class
Preeti Agarwal is not on the time zone mailing list; direct replies appropriately. --ado -----Original Message----- From: Agarwal, Preeti (Med, GEMS-IT) [mailto:Preeti.Agarwal@med.ge.com] Sent: Thursday, July 08, 2004 5:14 PM To: 'tz@elsie.nci.nih.gov' Subject: Need to use unix TZ timezone strings in java Timezone class Hi, We have an application that uses the unix timezone string formats "EST5EDT", "PST8PDT" etc. I need to convert these timezone strings into equivalent java timezones that can be understood by java.util.TimeZone class. If I pass the above unix timezone strings, it returns the server timezone and not the java equivalent of the unix timezone. I would appreciate any help in resolving this. Thanks, Preeti
"Olson, Arthur David (NIH/NCI)" <olsona@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.
participants (2)
-
Olson, Arthur David (NIH/NCI) -
Paul Eggert