Name

TimeZone

Synopsis

A TimeZone object holds information for a specific time zone, such as its offset from GMT and whether it observes daylight savings. The getDefault() method returns the default TimeZone for the device. A list of the time zones that a device supports can be obtained using the static getAvailableIDs() method. A TimeZone object for a specific time zone can be obtained by calling the getTimeZone() method, passing the time zone’s identifier, which must be one of the strings returned by the getAvailableIDs() method. Note that CLDC devices are only required to support their default time zone. Therefore, it may not be possible for application code to obtain a TimeZone object for any other time zone.

A TimeZone object contains a fixed time offset from GMT. This value, which is expressed in milliseconds, can be obtained by calling the getRawOffset() method. This value does not take into account daylight savings time. If a time zone uses daylight savings time, which can be determined from the useDaylightTime() method, the actual offset on any given date depends on whether daylight savings time is in force. The offset from GMT adjusted for daylight savings can be obtained from the getOffset() method, which returns the offset in force at a specified date and time.

public abstract class TimeZone {  
// Public Constructors
   public TimeZone();    
// Public Class Methods
   public static String[] getAvailableIDs();  
   public static TimeZone getDefault();                          // synchronized public static ...

Get J2ME in a Nutshell 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.