If you program in Java and have to convert dates and times between different timezones then you will know that the Date, Calendar & TimeZone objects of the java.util package are the way to go.
The JavaDoc for java.util.TimeZone mentions that you can use a 'time zone ID' of "America/Los_Angeles" to get the US Pacific Time. It doesn't give examples of any other time zone ID, so here is a list of the standard US time zone IDs:
(Table sourced from Statoids: Time Zones of the United States.)
Technorati Tags: Java, TimeZone, Calendar, Date, Daylight Savings, Andrew Beacock
The JavaDoc for java.util.TimeZone mentions that you can use a 'time zone ID' of "America/Los_Angeles" to get the US Pacific Time. It doesn't give examples of any other time zone ID, so here is a list of the standard US time zone IDs:
Area | Abbrev | Zone Name |
---|---|---|
Eastern Time | EST | America/New_York |
Central Time | CST | America/Chicago |
Mountain Time | MST | America/Denver |
Pacific Time | PST | America/Los_Angeles |
Alaska Time | AST | America/Anchorage |
Hawaii-Aleutian Time | HST | America/Adak |
(Table sourced from Statoids: Time Zones of the United States.)
Technorati Tags: Java, TimeZone, Calendar, Date, Daylight Savings, Andrew Beacock
Comments
I found it rather interesting that the TimeZone class doesn't seem to recognize "Central Standard Time", even though it's mentioned in the javadoc. It seemed to give up and just use GMT. I had to use America/Chicago to make it work.
Thanks for posting your message - I used it to construct the appropriate entries under the 'zi' folder in the runtime - it stopped the exceptions.
Most importantly, thank you for mentioning the city in Alaska that Java uses for its timezone!
java ID : America/Phoenix
This is awesome content mate, thank you,