| java.lang.Object java.util.TimeZone
TimeZone | abstract public class TimeZone implements Serializable,Cloneable(Code) | | TimeZone is an abstract class which represents a local time zone and its
daylight savings time rules. Subclasses support a particular calendar type,
such as the gregorian calendar.
Please note the type returned by factory methods, i.e.
getDefault() and getTimeZone(String) , is
implementation dependent, so that it may introduce serialization
incompatibility issue between different implementations. Harmony returns
instance of
SimpleTimeZone SimpleTimeZone so that the bytes
serialized by Harmony can be deserialized on other implementation
successfully, but the reverse compatibility cannot be guaranteed.
See Also: GregorianCalendar See Also: SimpleTimeZone |
Field Summary | |
static TimeZone | GMT | final public static int | LONG The LONG display name style. | final public static int | SHORT The SHORT display name style. |
Constructor Summary | |
public | TimeZone() Constructs a new instance of this class. |
Method Summary | |
public Object | clone() Answers a new TimeZone with the same ID, rawOffset and daylight savings
time rules as this TimeZone. | public static synchronized String[] | getAvailableIDs() Gets the available time zone IDs. | public static synchronized String[] | getAvailableIDs(int offset) Gets the available time zone IDs which match the specified offset from
GMT. | public int | getDSTSavings() Gets the daylight savings offset in milliseconds for this TimeZone. | public static synchronized TimeZone | getDefault() Gets the default time zone. | final public String | getDisplayName() Gets the LONG name for this TimeZone for the default Locale in standard
time. | final public String | getDisplayName(Locale locale) Gets the LONG name for this TimeZone for the specified Locale in standard
time. | final public String | getDisplayName(boolean daylightTime, int style) Gets the specified style of name (LONG or SHORT) for this TimeZone for
the default Locale in either standard or daylight time as specified. | public String | getDisplayName(boolean daylightTime, int style, Locale locale) Gets the specified style of name (LONG or SHORT) for this TimeZone for
the specified Locale in either standard or daylight time as specified. | public String | getID() Gets the ID of this TimeZone. | public int | getOffset(long time) Gets the offset from GMT of this TimeZone for the specified date. | abstract public int | getOffset(int era, int year, int month, int day, int dayOfWeek, int time) Gets the offset from GMT of this TimeZone for the specified date and
time. | abstract public int | getRawOffset() Gets the offset for standard time from GMT for this TimeZone. | public static synchronized TimeZone | getTimeZone(String name) Gets the time zone with the specified ID. | public boolean | hasSameRules(TimeZone zone) Answers if the specified TimeZone has the same raw offset as this
TimeZone. | abstract public boolean | inDaylightTime(Date time) Answers if the specified Date is in the daylight savings time period for
this TimeZone. | public static synchronized void | setDefault(TimeZone timezone) Sets the default time zone. | public void | setID(String name) Sets the ID of this TimeZone. | abstract public void | setRawOffset(int offset) Sets the offset for standard time from GMT for this TimeZone. | abstract public boolean | useDaylightTime() Answers if this TimeZone has a daylight savings time period. |
LONG | final public static int LONG(Code) | | The LONG display name style.
|
SHORT | final public static int SHORT(Code) | | The SHORT display name style.
|
TimeZone | public TimeZone()(Code) | | Constructs a new instance of this class.
|
clone | public Object clone()(Code) | | Answers a new TimeZone with the same ID, rawOffset and daylight savings
time rules as this TimeZone.
a shallow copy of this TimeZone See Also: java.lang.Cloneable |
getAvailableIDs | public static synchronized String[] getAvailableIDs()(Code) | | Gets the available time zone IDs.
an array of time zone ID strings |
getAvailableIDs | public static synchronized String[] getAvailableIDs(int offset)(Code) | | Gets the available time zone IDs which match the specified offset from
GMT.
Parameters: offset - the offset from GMT in milliseconds an array of time zone ID strings |
getDSTSavings | public int getDSTSavings()(Code) | | Gets the daylight savings offset in milliseconds for this TimeZone.
This implementation returns 3600000 (1 hour), or 0 if the time zone does
not observe daylight savings.
Subclasses may override to return daylight savings values other than 1
hour.
the daylight savings offset in milliseconds if this TimeZoneobserves daylight savings, zero otherwise. |
getDefault | public static synchronized TimeZone getDefault()(Code) | | Gets the default time zone.
the default time zone |
getDisplayName | final public String getDisplayName()(Code) | | Gets the LONG name for this TimeZone for the default Locale in standard
time. If the name is not available, the result is in the format
GMT[+-]hh:mm.
the TimeZone name |
getDisplayName | final public String getDisplayName(Locale locale)(Code) | | Gets the LONG name for this TimeZone for the specified Locale in standard
time. If the name is not available, the result is in the format
GMT[+-]hh:mm.
Parameters: locale - the Locale the TimeZone name |
getDisplayName | final public String getDisplayName(boolean daylightTime, int style)(Code) | | Gets the specified style of name (LONG or SHORT) for this TimeZone for
the default Locale in either standard or daylight time as specified. If
the name is not available, the result is in the format GMT[+-]hh:mm.
Parameters: daylightTime - true for daylight time, false for standard time Parameters: style - Either LONG or SHORT the TimeZone name |
getDisplayName | public String getDisplayName(boolean daylightTime, int style, Locale locale)(Code) | | Gets the specified style of name (LONG or SHORT) for this TimeZone for
the specified Locale in either standard or daylight time as specified. If
the name is not available, the result is in the format GMT[+-]hh:mm.
Parameters: daylightTime - true for daylight time, false for standard time Parameters: style - Either LONG or SHORT Parameters: locale - the Locale the TimeZone name |
getID | public String getID()(Code) | | Gets the ID of this TimeZone.
the time zone ID string |
getOffset | public int getOffset(long time)(Code) | | Gets the offset from GMT of this TimeZone for the specified date. The
offset includes daylight savings time if the specified date is within the
daylight savings time period.
Parameters: time - the date in milliseconds since January 1, 1970 00:00:00 GMT the offset from GMT in milliseconds |
getOffset | abstract public int getOffset(int era, int year, int month, int day, int dayOfWeek, int time)(Code) | | Gets the offset from GMT of this TimeZone for the specified date and
time. The offset includes daylight savings time if the specified date and
time are within the daylight savings time period.
Parameters: era - the GregorianCalendar era, either GregorianCalendar.BC orGregorianCalendar.AD Parameters: year - the year Parameters: month - the Calendar month Parameters: day - the day of the month Parameters: dayOfWeek - the Calendar day of the week Parameters: time - the time of day in milliseconds the offset from GMT in milliseconds |
getRawOffset | abstract public int getRawOffset()(Code) | | Gets the offset for standard time from GMT for this TimeZone.
the offset from GMT in milliseconds |
getTimeZone | public static synchronized TimeZone getTimeZone(String name)(Code) | | Gets the time zone with the specified ID.
Parameters: name - a time zone string ID the time zone with the specified ID or null if a time zone withthe specified ID does not exist |
hasSameRules | public boolean hasSameRules(TimeZone zone)(Code) | | Answers if the specified TimeZone has the same raw offset as this
TimeZone.
Parameters: zone - a TimeZone true when the TimeZones have the same raw offset, false otherwise |
inDaylightTime | abstract public boolean inDaylightTime(Date time)(Code) | | Answers if the specified Date is in the daylight savings time period for
this TimeZone.
Parameters: time - a Date true when the Date is in the daylight savings time period, falseotherwise |
setDefault | public static synchronized void setDefault(TimeZone timezone)(Code) | | Sets the default time zone.
Parameters: timezone - a TimeZone object |
setID | public void setID(String name)(Code) | | Sets the ID of this TimeZone.
Parameters: name - a string which is the time zone ID |
setRawOffset | abstract public void setRawOffset(int offset)(Code) | | Sets the offset for standard time from GMT for this TimeZone.
Parameters: offset - the offset from GMT in milliseconds |
useDaylightTime | abstract public boolean useDaylightTime()(Code) | | Answers if this TimeZone has a daylight savings time period.
true if this time zone has a daylight savings time period, falseotherwise |
|
|