TimeZone represents a time zone offset, and also figures out daylight
savings.
Typically, you get a TimeZone using getDefault
which creates a TimeZone based on the time zone where the program
is running. For example, for a program running in Japan, getDefault
creates a TimeZone object based on Japanese Standard Time.
You can also get a TimeZone using getTimeZone along
with a time zone ID. For instance, the time zone ID for the Pacific
Standard Time zone is "PST". So, you can get a PST TimeZone object
with:
TimeZone tz = TimeZone.getTimeZone("PST");
You can use getAvailableIDs method to iterate through
all the supported time zone IDs. You can then choose a
supported ID to get a favorite TimeZone.
public static synchronized String[] getAvailableIDs(int rawOffset)
Gets the available IDs according to the given time zone offset.
Parameters:
rawOffset - the given time zone GMT offset.
Returns:
an array of IDs, where the time zone for that ID has
the specified GMT offset. For example, "America/Phoenix" and "America/Denver"
both have GMT-07:00, but differ in daylight savings behavior.
Submit a bug or feature - Version 1.1.8 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1995-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.