java.util.TimeZone
java.lang.Object
java.util.SimpleTimeZone
java.io.Serializable, java.lang.Cloneable
New as of JDK 1.1
The TimeZone class is an abstract class that represents a time zone offset. In addition, the class incorporates knowledge about daylight savings time. Usually, you get a TimeZone object by calling getDefault(). This method creates a TimeZone that is appropriate for the current locale. You can also call getTimeZone() to obtain a TimeZone object for a specific time zone.
public abstract class java.util.TimeZone extends java.lang.Object implements java.io.Serializable, java.lang.Cloneable { // Class Methods public static synchronized String[] getAvailableIDs(); public static synchronized String[] getAvailableIDs(int rawOffset); public static synchronized TimeZone getDefault(); public static synchronized TimeZone getTimeZone(String ID); public static synchronized void setDefault(TimeZone zone); // Instance Methods public Object clone(); public String getID(); public abstract int getOffset(int era, int year, int month, int day, int dayOfWeek, int milliseconds); public abstract int getRawOffset(); public abstract boolean inDaylightTime(Date date); public void setID(String ID); public abstract void setRawOffset(int offsetMillis); public abstract boolean useDaylightTime(); }
An array of strings that contains the predefined time zone IDs.
This method returns a list of the predefined time zone IDs. Time zones are defined for the following ID values, starting from Greenwich, England, and progressing eastward around the world:
GMT | Greenwich Mean Time |
ECT | European Central Time |
EET | Eastern European Time |
ART | (Arabic) Egypt Standard Time |
EAT | Eastern African Time |
MET | Middle East Time |
NET | Near East Time |
PLT | Pakistan Lahore Time |
IST | India Standard Time |
BST | Bangladesh Standard Time |
VST | Vietnam Standard Time |
CTT | China Taiwan Time |
JST | Japan Standard Time |
ACT | Australia Central Time |
AET | Australia Eastern Time |
SST | Solomon Standard Time |
NST | New Zealand Standard Time |
MIT | Midway Islands Time |
HST | Hawaii Standard Time |
AST | Alaska Standard Time |
PST | Pacific Standard Time |
PNT | Phoenix Standard Time |
MST | Mountain Standard Time |
CST | Central Standard Time |
EST | Eastern Standard Time |
IET | Indiana Eastern Standard Time |
PRT | Puerto Rico and U.S. Virgin Islands Time |
CNT | Canada Newfoundland Time |
AGT | Argentina Standard Time |
BET | Brazil Eastern Time |
CAT | Central African Time |
An array of strings that contains the predefined time zone IDs with the given raw offset value.
This method returns a list of the predefined time zone IDs that have the given raw offset value from GMT. For example, both PNT and MST have an offset of GMT-07:00.
A TimeZone that represents the local time zone.
This method returns the default TimeZone object for the local system.
The ID of a time zone.
A TimeZone that represents the time zone with the given ID.
This method returns the TimeZone object that corresponds to the time zone with the given ID.
The new default time zone.
This method sets the TimeZone that is returned by getDefault().
A copy of this TimeZone.
Object.clone()
This method creates a copy of this TimeZone and returns it.
The ID of this TimeZone.
This method returns the ID string of this TimeZone.
public abstract int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis)
The era.
The year.
The month.
The day.
The day of the week.
The time of day in milliseconds.
An offset from GMT, in milliseconds.
This method calculates an offset from GMT for the given date for this TimeZone. In other words, the offset takes daylight savings time into account. The return value should be added to GMT to get local time.
An offset from GMT, in milliseconds.
This method returns the raw offset from GMT for this TimeZone. In other words, the offset does not take daylight savings time into account.
The date to be tested.
true if the given date is between the start and end of daylight savings time for this TimeZone; false otherwise.
This method returns a boolean value that indicates if the given date is in daylight savings time for this TimeZone.
The new time zone ID.
This method sets the ID of this TimeZone.
The new raw offset from GMT, in milliseconds.
This method is used to set the raw offset value for this TimeZone.
true if this TimeZone uses daylight savings time; false otherwise.
This method returns a boolean value that indicates whether or not this TimeZone uses daylight savings time.
Method | Inherited From | Method | Inherited From |
---|---|---|---|
finalize() |
Object |
getClass() |
Object |
hashCode() |
Object |
notify() |
Object |
notifyAll() |
Object |
toString() |
Object |
wait() |
Object |
wait(long) |
Object |
wait(long, int) |
Object |
Calendar, Cloneable, GregorianCalendar, Locale, Serializable, SimpleTimeZone