| java.lang.Object java.util.TimeZone sun.util.calendar.ZoneInfo
ZoneInfo | public class ZoneInfo extends TimeZone (Code) | | ZoneInfo is an implementation subclass of
java.util.TimeZone TimeZone that represents GMT offsets and
daylight saving time transitions of a time zone.
The daylight saving time transitions are described in the
ZoneInfo.transitions 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
ZoneInfo.getOffset(int,int,int,int,int,int) getOffset method that takes Gregorian calendar date fields.
This table covers transitions from 1900 until 2037 (as of version
1.4), Before 1900, it assumes that there was no daylight saving
time and the getOffset methods always return the
ZoneInfo.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 2037, it delegates
operations to a
java.util.SimpleTimeZone SimpleTimeZone object created using the daylight saving time schedule as of 2037.
The date items, transitions, GMT offset(s), etc. are read from a database
file. See
ZoneInfoFile for details.
See Also: java.util.SimpleTimeZone since: 1.4 |
Constructor Summary | |
public | ZoneInfo() A constructor. | public | ZoneInfo(String ID, int rawOffset) A Constructor for CustomID. | | ZoneInfo(String ID, int rawOffset, int dstSavings, int checksum, long[] transitions, int[] offsets, int[] simpleTimeZoneParams, boolean willGMTOffsetChange) Constructs a ZoneInfo instance. |
Method Summary | |
public boolean | equals(Object obj) Compares the equity of two ZoneInfo objects. | public static String[] | getAvailableIDs() Gets all available IDs supported in the Java run-time. | public static String[] | getAvailableIDs(int rawOffset) Gets all available IDs that have the same value as the
specified raw GMT offset.
Parameters: rawOffset - the GMT offset in milliseconds. | public int | getDSTSavings() 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. | public SimpleTimeZone | getLastRuleInstance() Returns a SimpleTimeZone object that represents the last
known daylight saving time rules. | public int | getOffset(long date) 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 | getOffset(int era, int year, int month, int day, int dayOfWeek, int milliseconds) 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) | public int | getOffsetsByWall(long wall, int[] offsets) | public int | getRawOffset() Returns the GMT offset of the current date. | public static TimeZone | getTimeZone(String ID) Gets the ZoneInfo for the given ID.
Parameters: ID - the ID for a ZoneInfo. | public boolean | hasSameRules(TimeZone other) Returns true if this zone has the same raw GMT offset value and
transition table as another zone info. | public int | hashCode() Returns a hash code value calculated from the GMT offset and
transitions. | public boolean | inDaylightTime(Date date) Queries if the specified date is in Daylight Saving Time. | public synchronized void | setRawOffset(int offsetMillis) Sets the base time zone offset from GMT. | public String | toString() Returns a string representation of this time zone. | public boolean | useDaylightTime() Queries if this time zone uses Daylight Saving Time in the last known rule. |
ZoneInfo | public ZoneInfo()(Code) | | A constructor.
|
ZoneInfo | public ZoneInfo(String ID, int rawOffset)(Code) | | A Constructor for CustomID.
|
ZoneInfo | ZoneInfo(String ID, int rawOffset, int dstSavings, int checksum, long[] transitions, int[] offsets, int[] simpleTimeZoneParams, boolean willGMTOffsetChange)(Code) | | Constructs a ZoneInfo instance.
Parameters: ID - time zone name Parameters: rawOffset - GMT offset in milliseconds Parameters: dstSavings - daylight saving value in milliseconds or 0(zero) if this time zone doesn't observe Daylight Saving Time. Parameters: checksum - CRC32 value with all transitions table entryvalues Parameters: transitions - transition table Parameters: offsets - offset value table Parameters: simpleTimeZoneParams - parameter values for constructingSimpleTimeZone Parameters: willGMTOffsetChange - the value of willGMTOffsetChange |
equals | public boolean equals(Object obj)(Code) | | Compares the equity of two ZoneInfo objects.
Parameters: obj - the object to be compared with true if given object is same as this ZoneInfo object,false otherwise. |
getAvailableIDs | public static String[] getAvailableIDs()(Code) | | Gets all available IDs supported in the Java run-time.
an array of time zone IDs. |
getAvailableIDs | public static String[] getAvailableIDs(int rawOffset)(Code) | | Gets all available IDs that have the same value as the
specified raw GMT offset.
Parameters: rawOffset - the GMT offset in milliseconds. Thisvalue should not include any daylight saving time. an array of time zone IDs. |
getDSTSavings | public int getDSTSavings()(Code) | | 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.
the number of milliseconds the time is advanced with respect tostandard time when daylight saving time is in effect. |
getLastRuleInstance | public SimpleTimeZone getLastRuleInstance()(Code) | | Returns a SimpleTimeZone object that represents the last
known daylight saving time rules.
a SimpleTimeZone object or null if this time zonedoesn't observe DST. |
getOffset | public int getOffset(long date)(Code) | | 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.
Parameters: date - the milliseconds in UTC the milliseconds to add to UTC to get local wall time |
getOffset | public int getOffset(int era, int year, int month, int day, int dayOfWeek, int milliseconds)(Code) | | 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
Calendar.ZONE_OFFSET Calendar.get(ZONE_OFFSET) +
Calendar.DST_OFFSET Calendar.get(DST_OFFSET) instead of calling this method.
Parameters: era - The era of the given date. The value must be eitherGregorianCalendar.AD or GregorianCalendar.BC. Parameters: year - The year in the given date. Parameters: month - The month in the given date. Month is 0-based. e.g.,0 for January. Parameters: day - The day-in-month of the given date. Parameters: dayOfWeek - The day-of-week of the given date. Parameters: millis - The milliseconds in day in standard local time. The milliseconds to add to UTC to get local time. |
getOffsets | public int getOffsets(long utc, int[] offsets)(Code) | | |
getOffsetsByWall | public int getOffsetsByWall(long wall, int[] offsets)(Code) | | |
getRawOffset | public int getRawOffset()(Code) | | Returns the GMT offset of the current date. This GMT offset
value is not modified during Daylight Saving Time.
the GMT offset value in milliseconds to add to UTC timeto get local standard time |
getTimeZone | public static TimeZone getTimeZone(String ID)(Code) | | Gets the ZoneInfo for the given ID.
Parameters: ID - the ID for a ZoneInfo. See TimeZone for detail. the specified ZoneInfo object or null if there is notime zone of the ID. |
hasSameRules | public boolean hasSameRules(TimeZone other)(Code) | | 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.
Parameters: other - the ZoneInfo object to be compared with true if the given TimeZone has the sameGMT offset and transition information, false, otherwise. |
hashCode | public int hashCode()(Code) | | Returns a hash code value calculated from the GMT offset and
transitions.
a hash code of this time zone |
inDaylightTime | public boolean inDaylightTime(Date date)(Code) | | Queries if the specified date is in Daylight Saving Time.
|
setRawOffset | public synchronized void setRawOffset(int offsetMillis)(Code) | | Sets the base time zone offset from GMT. This operation
modifies all the transitions of this ZoneInfo object, including
historical ones, if applicable.
Parameters: offsetMillis - the base time zone offset to GMT. See Also: getRawOffset |
toString | public String toString()(Code) | | Returns a string representation of this time zone.
the string |
useDaylightTime | public boolean useDaylightTime()(Code) | | Queries if this time zone uses Daylight Saving Time in the last known rule.
|
|
|