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
(); }
Get Wireless Java now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.