ZoneInfo is an implementation subclass of TimeZone that represents GMT offsets and
daylight saving time transitions of a time zone.
The daylight saving time transitions are described in the transitions table consisting of a chronological
sequence of transitions of GMT offset and/or daylight saving time
changes. Since all transitions are represented in UTC, in theory,
ZoneInfo can be used with any calendar systems except
for the getOffset
method that takes Gregorian calendar date fields.
This table covers transitions from 1900 until 2100 (as of version
23), Before 1900, it assumes that there was no daylight saving
time and the getOffset methods always return the
getRawOffset value. No Local Mean Time is supported. If a
specified date is beyond the transition table and this time zone is
supposed to observe daylight saving time in 2100, it delegates
operations to a SimpleTimeZone
object created using the daylight saving time schedule as of 2100.
The date items, transitions, GMT offset(s), etc. are read from a database
file. See ZoneInfoFile for details.
java.util.SimpleTimeZone
| Modifier and Type | Field and Description |
|---|---|
| private int | checksum
A CRC32 value of all pairs of transition time (in milliseconds
in |
| private transient boolean | dirty
True if the object has been modified after its instantiation. |
| private static final long | |
| private static final int | |
| private int | dstSavings
The amount of time in milliseconds saved during daylight saving time. |
| private transient SimpleTimeZone | |
| private static final long | |
| private int[] | offsets
This array holds all unique offset values in milliseconds. |
| private int | rawOffset
The raw GMT offset in milliseconds between this zone and GMT. |
| private int | rawOffsetDiff
Difference in milliseconds from the original GMT offset in case
the raw offset value has been modified by calling |
| private static final long | |
| private int[] | simpleTimeZoneParams
SimpleTimeZone parameter values. |
| private static final int | |
| private static final int | |
| private long[] | transitions
This array describes transitions of GMT offsets of this time zone, including both raw offset changes and daylight saving time changes. |
| private static final int | |
| private static final int | |
| private boolean | willGMTOffsetChange
True if the raw GMT offset value would change after the time zone data has been generated; false, otherwise. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| pack-priv | ZoneInfo(String
time zone name ID, int GMT offset in milliseconds rawOffset, int daylight saving value in milliseconds or 0
(zero) if this time zone doesn't observe Daylight Saving Time. dstSavings, int CRC32 value with all transitions table entry
values checksum, long[] transition table transitions, int[] offset value table offsets, int[] parameter values for constructing
SimpleTimeZone simpleTimeZoneParams, boolean the value of willGMTOffsetChange willGMTOffsetChange)Constructs a ZoneInfo instance. |
| Modifier and Type | Method and Description |
|---|---|
| public static Stream | Returns: a stream of time zone IDs.Hides java. Gets all available IDs supported in the Java run-time. |
| public static Stream | Returns: a stream of time zone IDs.the GMT offset in milliseconds. This
value should not include any daylight saving time. rawOffset)Hides java. Gets all available IDs that have the same value as the specified raw GMT offset. |
| public Object | |
| public boolean | Returns: true if given object is same as this ZoneInfo object, false otherwise.the object to be compared with obj)Overrides java. Compares the equity of two ZoneInfo objects. |
| public static Map | Returns: the Map that holds the mappings from alias time zone IDs to their standard time zone IDs, or null ifZoneInfoMappings file is not available.Returns a Map from alias time zone IDs to their standard time zone IDs. |
| public static String[] | Returns: an array of time zone IDs.Hides java. Gets all available IDs supported in the Java run-time. |
| public static String[] | Returns: an array of time zone IDs.the GMT offset in milliseconds. This
value should not include any daylight saving time. rawOffset)Hides java. Gets all available IDs that have the same value as the specified raw GMT offset. |
| public int | Returns: the number of milliseconds the time is advanced with respect to standard time when daylight saving time is in effect.Overrides java. Returns the amount of time in milliseconds that the clock is advanced during daylight saving time is in effect in its last daylight saving time rule. |
| private int | |
| private synchronized SimpleTimeZone | getLastRule()
Returns a SimpleTimeZone object representing the last GMT offset and DST schedule or null if this time zone doesn't observe DST. |
| public SimpleTimeZone | Returns: a SimpleTimeZone object or null if this time zone doesn't observe DST.Returns a SimpleTimeZone object that represents the last known daylight saving time rules. |
| public int | Returns: the milliseconds to add to UTC to get local wall timethe milliseconds in UTC date)Overrides java. Returns the difference in milliseconds between local time and UTC of given time, taking into account both the raw offset and the effect of daylight savings. |
| public int | Returns: The milliseconds to add to UTC to get local time.The era of the given date. The value must be either
GregorianCalendar.AD or GregorianCalendar.BC. era, int The year in the given date. year, int The month in the given date. Month is 0-based. e.g.,
0 for January. month, int The day-in-month of the given date. day, int The day-of-week of the given date. dayOfWeek, int The milliseconds in day in standard local time. milliseconds)Implements abstract java. Returns the difference in milliseconds between local time and UTC, taking into account both the raw offset and the effect of daylight savings, for the specified date and time. |
| public int | getOffsets(long utc, int[] offsets)
Hides java. Gets the raw GMT offset and the amount of daylight saving of this time zone at the given time. |
| private int | |
| public int | |
| public int | |
| public int | Returns: the GMT offset value in milliseconds to add to UTC time to get local standard timeImplements abstract java. Returns the GMT offset of the current date. |
| public static TimeZone | Returns: the specified ZoneInfo object, or null if there is no time zone of the ID.the ID for a ZoneInfo. See TimeZone for detail. ID)Hides java. Gets the ZoneInfo for the given ID. |
| private int | |
| public int | Returns: a hash code of this time zoneOverrides java. Returns a hash code value calculated from the GMT offset and transitions. |
| public boolean | Returns: true if the givenTimeZone has the same
GMT offset and transition information; false, otherwise.the ZoneInfo object to be compared with other)Overrides java. Returns true if this zone has the same raw GMT offset value and transition table as another zone info. |
| public boolean | inDaylightTime(Date date)
Implements abstract java. Queries if the specified date is in Daylight Saving Time. |
| public boolean | |
| public boolean | observesDaylightTime()
Overrides java. Returns |
| private void | |
| public synchronized void | setRawOffset(int
the base time zone offset to GMT. offsetMillis)Implements abstract java. Sets the base time zone offset from GMT. |
| public String | Returns: the stringOverrides java. Returns a string representation of this time zone. |
| public boolean | useDaylightTime()
Implements abstract java. Queries if this time zone uses Daylight Saving Time in the last known rule. |
| checksum | back to summary |
|---|---|
| private int checksum A CRC32 value of all pairs of transition time (in milliseconds
in | |
| dirty | back to summary |
|---|---|
| private transient boolean dirty True if the object has been modified after its instantiation. | |
| DST_MASK | back to summary |
|---|---|
| private static final long DST_MASK | |
| DST_NSHIFT | back to summary |
|---|---|
| private static final int DST_NSHIFT | |
| dstSavings | back to summary |
|---|---|
| private int dstSavings The amount of time in milliseconds saved during daylight saving
time. If | |
| lastRule | back to summary |
|---|---|
| private transient SimpleTimeZone lastRule | |
| OFFSET_MASK | back to summary |
|---|---|
| private static final long OFFSET_MASK | |
| offsets | back to summary |
|---|---|
| private int[] offsets This array holds all unique offset values in milliseconds. Index values to this array are stored in the transitions array elements. | |
| rawOffset | back to summary |
|---|---|
| private int rawOffset The raw GMT offset in milliseconds between this zone and GMT. Negative offsets are to the west of Greenwich. To obtain local standard time, add the offset to GMT time. | |
| rawOffsetDiff | back to summary |
|---|---|
| private int rawOffsetDiff Difference in milliseconds from the original GMT offset in case
the raw offset value has been modified by calling | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. | |
| simpleTimeZoneParams | back to summary |
|---|---|
| private int[] simpleTimeZoneParams SimpleTimeZone parameter values. It has to have either 8 for
| |
| STANDARD_TIME | back to summary |
|---|---|
| private static final int STANDARD_TIME | |
| TRANSITION_NSHIFT | back to summary |
|---|---|
| private static final int TRANSITION_NSHIFT | |
| transitions | back to summary |
|---|---|
| private long[] transitions This array describes transitions of GMT offsets of this time zone, including both raw offset changes and daylight saving time changes. A long integer consists of four bit fields.
| |
| UTC_TIME | back to summary |
|---|---|
| private static final int UTC_TIME | |
| WALL_TIME | back to summary |
|---|---|
| private static final int WALL_TIME | |
| willGMTOffsetChange | back to summary |
|---|---|
| private boolean willGMTOffsetChange True if the raw GMT offset value would change after the time zone data has been generated; false, otherwise. The default value is false. | |
| ZoneInfo | back to summary |
|---|---|
| public ZoneInfo() A constructor. | |
| ZoneInfo | back to summary |
|---|---|
| public ZoneInfo(String ID, int rawOffset) A Constructor for CustomID. | |
| ZoneInfo | back to summary |
|---|---|
| pack-priv ZoneInfo(String ID, int rawOffset, int dstSavings, int checksum, long[] transitions, int[] offsets, int[] simpleTimeZoneParams, boolean willGMTOffsetChange) Constructs a ZoneInfo instance.
| |
| availableIDs | back to summary |
|---|---|
| public static Stream Hides java. Gets all available IDs supported in the Java run-time. | |
| availableIDs | back to summary |
|---|---|
| public static Stream Hides java. Gets all available IDs that have the same value as the specified raw GMT offset. | |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. Returns a copy of this | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Compares the equity of two ZoneInfo objects.
| |
| getAliasTable | back to summary |
|---|---|
| public static Map Returns a Map from alias time zone IDs to their standard time zone IDs. | |
| getAvailableIDs | back to summary |
|---|---|
| public static String[] getAvailableIDs() Hides java. Gets all available IDs supported in the Java run-time.
| |
| getAvailableIDs | back to summary |
|---|---|
| public static String[] getAvailableIDs(int rawOffset) Hides java. Gets all available IDs that have the same value as the specified raw GMT offset.
| |
| getDSTSavings | back to summary |
|---|---|
| public int getDSTSavings() Overrides java. Returns the amount of time in milliseconds that the clock is advanced during daylight saving time is in effect in its last daylight saving time rule.
| |
| getLastRawOffset | back to summary |
|---|---|
| private int getLastRawOffset() | |
| getLastRule | back to summary |
|---|---|
| private synchronized SimpleTimeZone getLastRule() Returns a SimpleTimeZone object representing the last GMT offset and DST schedule or null if this time zone doesn't observe DST. | |
| getLastRuleInstance | back to summary |
|---|---|
| public SimpleTimeZone getLastRuleInstance() Returns a SimpleTimeZone object that represents the last known daylight saving time rules.
| |
| getOffset | back to summary |
|---|---|
| public int getOffset(long date) Overrides java. Returns the difference in milliseconds between local time and UTC of given time, taking into account both the raw offset and the effect of daylight savings.
| |
| getOffset | back to summary |
|---|---|
| public int getOffset(int era, int year, int month, int day, int dayOfWeek, int milliseconds) Implements abstract java. Returns the difference in milliseconds between local time and UTC, taking into account both the raw offset and the effect of daylight savings, for the specified date and time. This method assumes that the start and end month are distinct. This method assumes a Gregorian calendar for calculations. Note In general, clients should use
| |
| getOffsets | back to summary |
|---|---|
| public int getOffsets(long utc, int[] offsets) Hides java. Doc from java. Gets the raw GMT offset and the amount of daylight saving of this time zone at the given time. | |
| getOffsets | back to summary |
|---|---|
| private int getOffsets(long date, int[] offsets, int type) | |
| getOffsetsByStandard | back to summary |
|---|---|
| public int getOffsetsByStandard(long standard, int[] offsets) | |
| getOffsetsByWall | back to summary |
|---|---|
| public int getOffsetsByWall(long wall, int[] offsets) | |
| getRawOffset | back to summary |
|---|---|
| public int getRawOffset() Implements abstract java. Returns the GMT offset of the current date. This GMT offset value is not modified during Daylight Saving Time.
| |
| getTimeZone | back to summary |
|---|---|
| public static TimeZone getTimeZone(String ID) Hides java. Gets the ZoneInfo for the given ID. | |
| getTransitionIndex | back to summary |
|---|---|
| private int getTransitionIndex(long date, int type) | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns a hash code value calculated from the GMT offset and transitions.
| |
| hasSameRules | back to summary |
|---|---|
| public boolean hasSameRules(TimeZone other) Overrides java. Returns true if this zone has the same raw GMT offset value and transition table as another zone info. If the specified TimeZone object is not a ZoneInfo instance, this method returns true if the specified TimeZone object has the same raw GMT offset value with no daylight saving time.
| |
| inDaylightTime | back to summary |
|---|---|
| public boolean inDaylightTime(Date date) Implements abstract java. Queries if the specified date is in Daylight Saving Time. | |
| isDirty | back to summary |
|---|---|
| public boolean isDirty() | |
| observesDaylightTime | back to summary |
|---|---|
| public boolean observesDaylightTime() Overrides java. Doc from java. Returns The default implementation returns
| |
| readObject | back to summary |
|---|---|
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException
| |
| setRawOffset | back to summary |
|---|---|
| public synchronized void setRawOffset(int offsetMillis) Implements abstract java. Sets the base time zone offset from GMT. This operation modifies all the transitions of this ZoneInfo object, including historical ones, if applicable.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a string representation of this time zone.
| |
| useDaylightTime | back to summary |
|---|---|
| public boolean useDaylightTime() Implements abstract java. Queries if this time zone uses Daylight Saving Time in the last known rule. | |