| java.lang.Object | |
| ↳ | java.util.TimeZone |
Known Direct Subclasses
|
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 so that the
bytes serialized by Harmony can be deserialized on other implementation successfully,
but the reverse compatibility cannot be guaranteed.
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| int | LONG | The LONG display name style. | |||||||||
| int | SHORT | The SHORT display name style. | |||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new instance of this class.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Returns a new TimeZone with the same ID, rawOffset and daylight savings
time rules as this TimeZone.
| |||||||||||
Gets the available time zone IDs.
| |||||||||||
Gets the available time zone IDs which match the specified offset from
GMT.
| |||||||||||
Gets the daylight savings offset in milliseconds for this TimeZone.
| |||||||||||
Gets the default time zone.
| |||||||||||
Gets the LONG name for this TimeZone for the default Locale in standard
time.
| |||||||||||
Gets the specified style of name (LONG or SHORT) for this TimeZone for
the default Locale in either standard or daylight time as specified.
| |||||||||||
Gets the LONG name for this TimeZone for the specified Locale in standard
time.
| |||||||||||
Gets the specified style of name (LONG or SHORT) for this TimeZone for
the specified Locale in either standard or daylight time as specified.
| |||||||||||
Gets the ID of this TimeZone.
| |||||||||||
Gets the offset from GMT of this TimeZone for the specified date and
time.
| |||||||||||
Gets the offset from GMT of this TimeZone for the specified date.
| |||||||||||
Gets the offset for standard time from GMT for this TimeZone.
| |||||||||||
Gets the time zone with the specified ID.
| |||||||||||
Returns if the specified TimeZone has the same raw offset as this
TimeZone.
| |||||||||||
Returns if the specified Date is in the daylight savings time period for
this TimeZone.
| |||||||||||
Sets the default time zone.
| |||||||||||
Sets the ID of this TimeZone.
| |||||||||||
Sets the offset for standard time from GMT for this TimeZone.
| |||||||||||
Returns if this TimeZone has a daylight savings time period.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
The LONG display name style.
The SHORT display name style.
Constructs a new instance of this class.
Returns a new TimeZone with the same ID, rawOffset and daylight savings time rules as this TimeZone.
Gets the available time zone IDs.
Gets the available time zone IDs which match the specified offset from GMT.
| offset | the offset from GMT in milliseconds |
|---|
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.
Gets the default time zone.
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.
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.
| daylightTime | true for daylight time, false for standard time |
|---|---|
| style | Either LONG or SHORT |
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.
| locale | the 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. If the name is not available, the result is in the format GMT[+-]hh:mm.
| daylightTime | true for daylight time, false for standard time |
|---|---|
| style | Either LONG or SHORT |
| locale | the Locale |
Gets the ID of this TimeZone.
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.
| era | the GregorianCalendar era, either GregorianCalendar.BC or GregorianCalendar.AD |
|---|---|
| year | the year |
| month | the Calendar month |
| day | the day of the month |
| dayOfWeek | the Calendar day of the week |
| time | the time of day in milliseconds |
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.
| time | the date in milliseconds since January 1, 1970 00:00:00 GMT |
|---|
Gets the offset for standard time from GMT for this TimeZone.
Gets the time zone with the specified ID.
| name | a time zone string ID |
|---|
Returns if the specified TimeZone has the same raw offset as this TimeZone.
| zone | a TimeZone |
|---|
Returns if the specified Date is in the daylight savings time period for this TimeZone.
| time | a Date |
|---|
Sets the default time zone. If passed null, then
the next time getDefault() is called, the default time
zone with be determined. This behavior is slightly different than
the canonical description of this method, but it follows the spirit
of it.
| timezone | a TimeZone object |
|---|
Sets the ID of this TimeZone.
| name | a string which is the time zone ID |
|---|
Sets the offset for standard time from GMT for this TimeZone.
| offset | the offset from GMT in milliseconds |
|---|
Returns if this TimeZone has a daylight savings time period.