Name
java.util.TimeZone
Synopsis
This class is a scaled-down version of the J2SE
TimeZone class. It represents a geographic time
zone and can be used in conjunction with the
Calendar object. Time zones can be created by
passing in an ID, such as “America/Chicago” or
“GMT,” to the static getTimeZone()
method. To check the available IDs recognized by this class, call the
getAvailableIDs() method. An object representing
the current time zone of the device can be obtained with the static
getDefault() method.
getOffset() returns an integer milliseconds
offset, which you add to the GMT time in order to get the current
time, taking into account daylight savings, while
getRawOffset() simply returns the geographic
offset in milliseconds. To test whether the
TimeZone object is currently using daylight
savings in its calculations, call
useDaylightTime().
public abstract classTimeZone{ // constructor publicTimeZone(); // static methods public static TimeZonegetTimeZone(String ID); public static TimeZonegetDefault(); public static String[]getAvailableIDs(); // public instance methods methods public abstract intgetOffset(int era, int year, int month, int day, int dayOfWeek, int millis); public abstract intgetRawOffset(); public abstract booleanuseDaylightTime(); }
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access