Skip to main content

A list of US 'time zone IDs' for use with java.util.TimeZone

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:

AreaAbbrevZone Name
Eastern TimeESTAmerica/New_York
Central TimeCSTAmerica/Chicago
Mountain TimeMSTAmerica/Denver
Pacific TimePSTAmerica/Los_Angeles
Alaska TimeASTAmerica/Anchorage
Hawaii-Aleutian TimeHSTAmerica/Adak

(Table sourced from Statoids: Time Zones of the United States.)

Technorati Tags: , , , , ,

Comments

Anonymous said…
I appreciate your list of time zone ids. Strange that you have to run TimeZone.getAvailableIDs() to get the full list, rather than just have it documented.

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.
Andrew Beacock said…
I always thought it was strange that it wasn't JavaDoc'ed, that's why I posted the log.
Anonymous said…
It also doesn't seem to recognize the 'US/Pacific', 'US/Eastern', etc variants...

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!
Anonymous said…
I would add Arizona (Phoenix) to the list of American time zones due to the fact that this state does not participate in daylight savings time.

java ID : America/Phoenix
Anonymous said…
Part of Indiana does not do daylight savings time either.
Andrew Beacock said…
Thanks for pointing that out!
manjula said…
Andy, thank you for sharing.
Unknown said…
great work to you!. Thanks for sharing your advice.
Unknown said…

This is awesome content mate, thank you,