Class TimeZone

Class java.util.TimeZone

Class Members | This Package | All Packages
java.lang.Object
   |
   +----java.util.TimeZone

public abstract class TimeZone
extends Object
implements Serializable, Cloneable

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.

See Also:
Calendar, GregorianCalendar, SimpleTimeZone