|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ibm.icu.util.TimeZone
com.ibm.icu.util.BasicTimeZone
com.ibm.icu.util.RuleBasedTimeZone
public class RuleBasedTimeZone
RuleBasedTimeZone is a concrete subclass of TimeZone that allows users to define
custom historic time transition rules.
TimeZoneRule,
Serialized Form| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.ibm.icu.util.TimeZone |
|---|
TimeZone.SystemTimeZoneType |
| Field Summary |
|---|
| Fields inherited from class com.ibm.icu.util.BasicTimeZone |
|---|
FORMER_LATTER_MASK, LOCAL_DST, LOCAL_FORMER, LOCAL_LATTER, LOCAL_STD, STD_DST_MASK |
| Fields inherited from class com.ibm.icu.util.TimeZone |
|---|
GENERIC_LOCATION, LONG, LONG_GENERIC, LONG_GMT, SHORT, SHORT_COMMONLY_USED, SHORT_GENERIC, SHORT_GMT, TIMEZONE_ICU, TIMEZONE_JDK, TimeZoneLogger, UNKNOWN_ZONE_ID |
| Constructor Summary | |
|---|---|
RuleBasedTimeZone(String id,
InitialTimeZoneRule initialRule)
Constructs a RuleBasedTimeZone object with the ID and the
InitialTimeZoneRule |
|
| Method Summary | |
|---|---|
void |
addTransitionRule(TimeZoneRule rule)
Adds the TimeZoneRule which represents time transitions. |
Object |
clone()
Overrides clone. |
TimeZoneTransition |
getNextTransition(long base,
boolean inclusive)
[icu] Returns the first time zone transition after the base time. |
int |
getOffset(int era,
int year,
int month,
int day,
int dayOfWeek,
int milliseconds)
Gets the time zone offset, for current date, modified in case of daylight savings. |
void |
getOffset(long time,
boolean local,
int[] offsets)
Returns the time zone raw and GMT offset for the given moment in time. |
void |
getOffsetFromLocal(long date,
int nonExistingTimeOpt,
int duplicatedTimeOpt,
int[] offsets)
Deprecated. This API is ICU internal only. |
TimeZoneTransition |
getPreviousTransition(long base,
boolean inclusive)
[icu] Returns the last time zone transition before the base time. |
int |
getRawOffset()
Gets unmodified offset, NOT modified in case of daylight savings. |
TimeZoneRule[] |
getTimeZoneRules()
[icu] Returns the array of TimeZoneRule which represents the rule
of this time zone object. |
boolean |
hasSameRules(TimeZone other)
Returns true if this zone has the same rule and offset as another zone. |
boolean |
inDaylightTime(Date date)
Queries if the given date is in daylight savings time in this time zone. |
void |
setRawOffset(int offsetMillis)
Sets the base time zone offset to GMT. |
boolean |
useDaylightTime()
Queries if this time zone uses daylight savings time. |
| Methods inherited from class com.ibm.icu.util.BasicTimeZone |
|---|
getSimpleTimeZoneRulesNear, getTimeZoneRules, hasEquivalentTransitions, hasEquivalentTransitions |
| Methods inherited from class com.ibm.icu.util.TimeZone |
|---|
countEquivalentIDs, equals, getAvailableIDs, getAvailableIDs, getAvailableIDs, getAvailableIDs, getCanonicalID, getCanonicalID, getDefault, getDefaultTimeZoneType, getDisplayName, getDisplayName, getDisplayName, getDisplayName, getDisplayName, getDisplayName, getDSTSavings, getEquivalentID, getID, getOffset, getRegion, getTimeZone, getTimeZone, getTZDataVersion, hashCode, setDefault, setDefaultTimeZoneType, setID |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RuleBasedTimeZone(String id,
InitialTimeZoneRule initialRule)
RuleBasedTimeZone object with the ID and the
InitialTimeZoneRule
id - The time zone ID.initialRule - The initial time zone rule.| Method Detail |
|---|
public void addTransitionRule(TimeZoneRule rule)
TimeZoneRule which represents time transitions.
The TimeZoneRule must have start times, that is, the result
of TimeZoneRule.isTransitionRule() must be true.
Otherwise, IllegalArgumentException is thrown.
rule - The TimeZoneRule.
public int getOffset(int era,
int year,
int month,
int day,
int dayOfWeek,
int milliseconds)
getOffset in class TimeZoneera - the era of the given date.year - the year in the given date.month - the month in the given date.
Month is 0-based. e.g., 0 for January.day - the day-in-month of the given date.dayOfWeek - the day-of-week of the given date.milliseconds - the millis in day in standard local time.
public void getOffset(long time,
boolean local,
int[] offsets)
getOffset in class TimeZonetime - moment in time for which to return offsets, in
units of milliseconds from January 1, 1970 0:00 GMT, either GMT
time or local wall time, depending on `local'.local - if true, `date' is local wall time; otherwise it
is in GMT time.offsets - output parameter to receive the raw offset, that
is, the offset not including DST adjustments, in offsets[0],
and the DST offset, that is, the offset to be added to
`rawOffset' to obtain the total offset between local and GMT
time, in offsets[1]. If DST is not in effect, the DST offset is
zero; otherwise it is a positive value, typically one hour.
public void getOffsetFromLocal(long date,
int nonExistingTimeOpt,
int duplicatedTimeOpt,
int[] offsets)
getOffsetFromLocal in class BasicTimeZonepublic int getRawOffset()
getRawOffset in class TimeZonepublic boolean inDaylightTime(Date date)
inDaylightTime in class TimeZonedate - the given Date.
public void setRawOffset(int offsetMillis)
setRawOffset in class TimeZoneoffsetMillis - the given base time zone offset to GMT.public boolean useDaylightTime()
useDaylightTime in class TimeZoneNote:The default implementation of
ICU TimeZone uses the tz database, which supports historic
rule changes, for system time zones. With the implementation,
there are time zones that used daylight savings time in the
past, but no longer used currently. For example, Asia/Tokyo has
never used daylight savings time since 1951. Most clients would
expect that this method to return false for such case.
The default implementation of this method returns true
when the time zone uses daylight savings time in the current
(Gregorian) calendar year.
public boolean hasSameRules(TimeZone other)
hasSameRules in class TimeZoneother - the TimeZone object to be compared with
public TimeZoneRule[] getTimeZoneRules()
TimeZoneRule which represents the rule
of this time zone object. The first element in the result array will
be the InitialTimeZoneRule instance for the initial rule.
The rest will be either AnnualTimeZoneRule or
TimeArrayTimeZoneRule instances representing transitions.
getTimeZoneRules in class BasicTimeZoneTimeZoneRule which represents this
time zone.
public TimeZoneTransition getNextTransition(long base,
boolean inclusive)
getNextTransition in class BasicTimeZonebase - The base time.inclusive - Whether the base time is inclusive or not.
Date holding the first time zone transition time
after the given base time, or null if no time zone transitions
are available after the base time.
public TimeZoneTransition getPreviousTransition(long base,
boolean inclusive)
getPreviousTransition in class BasicTimeZonebase - The base time.inclusive - Whether the base time is inclusive or not.
Date holding the last time zone transition time
before the given base time, or null if no time zone transitions
are available before the base time.public Object clone()
clone in class TimeZone
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||