Top Description Inners Fields Constructors Methods
com.ibm.icu.util

public abstract Class BasicTimeZone

extends TimeZone
Class Inheritance
Known Direct Subclasses
com.ibm.icu.util.RuleBasedTimeZone, com.ibm.icu.util.SimpleTimeZone, com.ibm.icu.util.VTimeZone, com.ibm.icu.impl.OlsonTimeZone
Imports
java.util.BitSet, .Date, .LinkedList, .List, com.ibm.icu.impl.Grego

ICU

BasicTimeZone extends TimeZone with additional methods to access time zone transitions and rules. All ICU TimeZone concrete subclasses extend this class. APIs added to java.util.TimeZone by BasicTimeZone are annotated with '[icu]'.
ICU Status
Stable since ICU 3.8.
See Also
com.ibm.icu.util.TimeZoneRule, com.ibm.icu.util.TimeZoneTransition

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
protected static final int
FORMER_LATTER_MASK

The bit mask for the former/latter option used by internal implementation.

protected static final int
LOCAL_DST

The time type option for daylight saving time used internally.

protected static final int
LOCAL_FORMER

The option designate former time used by internal implementation.

protected static final int
LOCAL_LATTER

The option designate latter time used by internal implementation.

protected static final int
LOCAL_STD

The time type option for standard time used by internal implementation.

private static final long
private static final long
protected static final int
STD_DST_MASK

The bit mask for the time type option used by internal implementation.

Inherited from com.ibm.icu.util.TimeZone:
GENERIC_LOCATIONGMT_ZONEGMT_ZONE_IDLONGLONG_GENERICLONG_GMTSHORTSHORT_COMMONLY_USEDSHORT_GENERICSHORT_GMTTIMEZONE_ICUTIMEZONE_JDKUNKNOWN_ZONEUNKNOWN_ZONE_ID

Constructor Summary

AccessConstructor and Description
protected
BasicTimeZone()

Protected no arg constructor.

protected
BasicTimeZone(String
the time zone ID.
ID
)

Deprecated This API is ICU internal only.
Constructing a BasicTimeZone with the given time zone ID.

Method Summary

Modifier and TypeMethod and Description
protected static int

Returns:

LocalOption's internal flag value.
getLocalOptionValue
(BasicTimeZone.LocalOption
A LocalOption
locOpt
)

Deprecated This API is ICU internal only.
Get LocalOption's internal flag value.
public abstract TimeZoneTransition

Returns:

A 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.
getNextTransition
(long
The base time.
base
,
boolean
Whether the base time is inclusive or not.
inclusive
)

ICU

public void
getOffsetFromLocal(long date, BasicTimeZone.LocalOption nonExistingTimeOpt, BasicTimeZone.LocalOption duplicatedTimeOpt, int[] offsets)

ICU

public abstract TimeZoneTransition

Returns:

A 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.
getPreviousTransition
(long
The base time.
base
,
boolean
Whether the base time is inclusive or not.
inclusive
)

ICU

public TimeZoneRule[]

Returns:

The array of TimeZoneRule, either a single InitialTimeZoneRule object, or a pair of AnnualTimeZoneRule with a single InitialTimeZoneRule. The first element in the array is always a InitialTimeZoneRule.
getSimpleTimeZoneRulesNear
(long
The date to be used for TimeZoneRule extraction.
date
)

ICU

public abstract TimeZoneRule[]

Returns:

The array of TimeZoneRule which represents this time zone.
getTimeZoneRules
()

ICU

public TimeZoneRule[]

Returns:

The array of TimeZoneRule which represents this time zone since the start time.
getTimeZoneRules
(long
The start time (inclusive).
start
)

ICU

public boolean

Returns:

true if the other time zone has the equivalent transitions in the time range. When tz is not a BasicTimeZone, this method returns false.
hasEquivalentTransitions
(TimeZone
The instance of TimeZone
tz
,
long
The start time of the evaluated time range (inclusive)
start
,
long
The end time of the evaluated time range (inclusive)
end
)

ICU

public boolean

Returns:

true if the other time zone has the equivalent transitions in the time range. When tz is not a BasicTimeZone, this method returns false.
hasEquivalentTransitions
(TimeZone
The instance of TimeZone
tz
,
long
The start time of the evaluated time range (inclusive)
start
,
long
The end time of the evaluated time range (inclusive)
end
,
boolean
When true, any transitions with only daylight saving amount changes will be ignored, except either of them is zero. For example, a transition from rawoffset 3:00/dstsavings 1:00 to rawoffset 2:00/dstsavings 2:00 is excluded from the comparison, but a transition from rawoffset 2:00/dstsavings 1:00 to rawoffset 3:00/dstsavings 0:00 is included.
ignoreDstAmount
)

ICU

Inherited from com.ibm.icu.util.TimeZone:
clonecloneAsThawedcountEquivalentIDsequalsforLocaleOrDefaultforULocaleOrDefaultfreezegetAvailableIDsgetAvailableIDsgetAvailableIDsgetAvailableIDsgetCanonicalIDgetCanonicalIDgetDefaultgetDefaultTimeZoneTypegetDisplayNamegetDisplayNamegetDisplayNamegetDisplayNamegetDisplayNamegetDisplayNamegetDSTSavingsgetEquivalentIDgetFrozenICUTimeZonegetFrozenTimeZonegetIanaIDgetIDgetIDForWindowsIDgetOffsetgetOffsetgetOffsetgetRawOffsetgetRegiongetTimeZonegetTimeZonegetTZDataVersiongetWindowsIDhashCodehasSameRulesinDaylightTimeisFrozenobservesDaylightTimesetDefaultsetDefaultTimeZoneTypesetICUDefaultsetIDsetRawOffsetuseDaylightTime

Field Detail

FORMER_LATTER_MASKback to summary
protected static final int FORMER_LATTER_MASK

Deprecated

This API is ICU internal only.

The bit mask for the former/latter option used by internal implementation.

Annotations
@Deprecated
ICU Status
Internal ICU component.
LOCAL_DSTback to summary
protected static final int LOCAL_DST

Deprecated

This API is ICU internal only.

The time type option for daylight saving time used internally.

Annotations
@Deprecated
ICU Status
Internal ICU component.
LOCAL_FORMERback to summary
protected static final int LOCAL_FORMER

Deprecated

This API is ICU internal only.

The option designate former time used by internal implementation.

Annotations
@Deprecated
ICU Status
Internal ICU component.
LOCAL_LATTERback to summary
protected static final int LOCAL_LATTER

Deprecated

This API is ICU internal only.

The option designate latter time used by internal implementation.

Annotations
@Deprecated
ICU Status
Internal ICU component.
LOCAL_STDback to summary
protected static final int LOCAL_STD

Deprecated

This API is ICU internal only.

The time type option for standard time used by internal implementation.

Annotations
@Deprecated
ICU Status
Internal ICU component.
MILLIS_PER_YEARback to summary
private static final long MILLIS_PER_YEAR
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.ibm.icu.util.TimeZone.serialVersionUID.

STD_DST_MASKback to summary
protected static final int STD_DST_MASK

Deprecated

This API is ICU internal only.

The bit mask for the time type option used by internal implementation.

Annotations
@Deprecated
ICU Status
Internal ICU component.

Constructor Detail

BasicTimeZoneback to summary
protected BasicTimeZone()

Protected no arg constructor.

ICU Status
Stable since ICU 3.8.
BasicTimeZoneback to summary
protected BasicTimeZone(String ID)

Deprecated

This API is ICU internal only.

Constructing a BasicTimeZone with the given time zone ID.

Parameters
ID:String

the time zone ID.

Annotations
@Deprecated
ICU Status
Internal ICU component.

Method Detail

getLocalOptionValueback to summary
protected static int getLocalOptionValue(BasicTimeZone.LocalOption locOpt)

Deprecated

This API is ICU internal only.

Get LocalOption's internal flag value. This is used by ICU internal implementation only.

Parameters
locOpt:BasicTimeZone.LocalOption

A LocalOption

Returns:int

LocalOption's internal flag value.

Annotations
@Deprecated
ICU Status
Internal ICU component.
getNextTransitionback to summary
public abstract TimeZoneTransition getNextTransition(long base, boolean inclusive)

ICU

Returns the first time zone transition after the base time.

Example code:{@. jcite com.ibm.icu.samples.util.timezone.BasicTimeZoneExample:---getNextTransitionExample}

Parameters
base:long

The base time.

inclusive:boolean

Whether the base time is inclusive or not.

Returns:TimeZoneTransition

A 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.

ICU Status
Stable since ICU 3.8.
getOffsetFromLocalback to summary
public void getOffsetFromLocal(long date, BasicTimeZone.LocalOption nonExistingTimeOpt, BasicTimeZone.LocalOption duplicatedTimeOpt, int[] offsets)

ICU

Returns time zone offsets from local wall time.
ICU Status
Stable since ICU 69.
getPreviousTransitionback to summary
public abstract TimeZoneTransition getPreviousTransition(long base, boolean inclusive)

ICU

Returns the last time zone transition before the base time.

Example code:{@. jcite com.ibm.icu.samples.util.timezone.BasicTimeZoneExample:---getPreviousTransitionExample}

Parameters
base:long

The base time.

inclusive:boolean

Whether the base time is inclusive or not.

Returns:TimeZoneTransition

A 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.

ICU Status
Stable since ICU 3.8.
getSimpleTimeZoneRulesNearback to summary
public TimeZoneRule[] getSimpleTimeZoneRulesNear(long date)

ICU

Returns the array of TimeZoneRule which represents the rule of this time zone object near the specified date. Some applications are not capable to handle historic time zone rule changes. Also some applications can only handle certain type of rule definitions. This method returns either a single InitialTimeZoneRule if this time zone does not have any daylight saving time within 1 year from the specified time, or a pair of AnnualTimeZoneRule whose rule type is DateTimeRule.DOW for date and DateTimeRule.WALL_TIME for time with a single InitialTimeZoneRule representing the initial time, when this time zone observes daylight saving time near the specified date. Thus, the result may be only valid for dates around the specified date.
Parameters
date:long

The date to be used for TimeZoneRule extraction.

Returns:TimeZoneRule[]

The array of TimeZoneRule, either a single InitialTimeZoneRule object, or a pair of AnnualTimeZoneRule with a single InitialTimeZoneRule. The first element in the array is always a InitialTimeZoneRule.

ICU Status
Stable since ICU 3.8.
getTimeZoneRulesback to summary
public abstract TimeZoneRule[] getTimeZoneRules()

ICU

Returns the array of 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.
Returns:TimeZoneRule[]

The array of TimeZoneRule which represents this time zone.

ICU Status
Stable since ICU 3.8.
getTimeZoneRulesback to summary
public TimeZoneRule[] getTimeZoneRules(long start)

ICU

Returns the array of TimeZoneRule which represents the rule of this time zone object since the specified start time. 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.

Example code:{@. jcite com.ibm.icu.samples.util.timezone.BasicTimeZoneExample:---getTimeZoneRulesExample}

Parameters
start:long

The start time (inclusive).

Returns:TimeZoneRule[]

The array of TimeZoneRule which represents this time zone since the start time.

ICU Status
Stable since ICU 3.8.
hasEquivalentTransitionsback to summary
public boolean hasEquivalentTransitions(TimeZone tz, long start, long end)

ICU

Checks if the time zone has equivalent transitions in the time range. This method returns true when all of transition times, from/to standard offsets and DST savings used by this time zone match the other in the time range.

Example code:{@. jcite com.ibm.icu.samples.util.timezone.BasicTimeZoneExample:---hasEquivalentTransitionsExample}

Parameters
tz:TimeZone

The instance of TimeZone

start:long

The start time of the evaluated time range (inclusive)

end:long

The end time of the evaluated time range (inclusive)

Returns:boolean

true if the other time zone has the equivalent transitions in the time range. When tz is not a BasicTimeZone, this method returns false.

ICU Status
Stable since ICU 3.8.
hasEquivalentTransitionsback to summary
public boolean hasEquivalentTransitions(TimeZone tz, long start, long end, boolean ignoreDstAmount)

ICU

Checks if the time zone has equivalent transitions in the time range. This method returns true when all of transition times, from/to standard offsets and DST savings used by this time zone match the other in the time range.
Parameters
tz:TimeZone

The instance of TimeZone

start:long

The start time of the evaluated time range (inclusive)

end:long

The end time of the evaluated time range (inclusive)

ignoreDstAmount:boolean

When true, any transitions with only daylight saving amount changes will be ignored, except either of them is zero. For example, a transition from rawoffset 3:00/dstsavings 1:00 to rawoffset 2:00/dstsavings 2:00 is excluded from the comparison, but a transition from rawoffset 2:00/dstsavings 1:00 to rawoffset 3:00/dstsavings 0:00 is included.

Returns:boolean

true if the other time zone has the equivalent transitions in the time range. When tz is not a BasicTimeZone, this method returns false.

ICU Status
Stable since ICU 3.8.
com.ibm.icu.util back to summary

public final Enum BasicTimeZone.LocalOption

extends Enum<BasicTimeZone.LocalOption>
Class Inheritance

ICU

Options used by getOffsetFromLocal(long, LocalOption, LocalOption, int[]) to specify how to interpret an input time when it does not exist, or when it is ambiguous, around a time zone transition.
ICU Status
Stable since ICU 69.

Field Summary

Modifier and TypeField and Description
public static final BasicTimeZone.LocalOption
DAYLIGHT_FORMER

An input time is interpreted as daylight saving time when local time is switched to/from standard time.

public static final BasicTimeZone.LocalOption
DAYLIGHT_LATTER

An input time is interpreted as daylight saving time when local time is switched to/from standard time.

private int
public static final BasicTimeZone.LocalOption
FORMER

An input time is always interpreted as local time before a time zone transition.

public static final BasicTimeZone.LocalOption
LATTER

An input time is always interpreted as local time after a time zone transition.

public static final BasicTimeZone.LocalOption
STANDARD_FORMER

An input time is interpreted as standard time when local time is switched to/from daylight saving time.

public static final BasicTimeZone.LocalOption
STANDARD_LATTER

An input time is interpreted as standard time when local time is switched to/from daylight saving time.

Constructor Summary

AccessConstructor and Description
private
LocalOption(int flagVal)

Method Summary

Modifier and TypeMethod and Description
public static BasicTimeZone.LocalOption
public static BasicTimeZone.LocalOption[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DAYLIGHT_FORMERback to summary
public static final BasicTimeZone.LocalOption DAYLIGHT_FORMER

An input time is interpreted as daylight saving time when local time is switched to/from standard time. When both sides of a time zone transition are standard time, or daylight saving time, the local time before the transition is used.

ICU Status
Stable since ICU 69.
DAYLIGHT_LATTERback to summary
public static final BasicTimeZone.LocalOption DAYLIGHT_LATTER

An input time is interpreted as daylight saving time when local time is switched to/from standard time. When both sides of a time zone transition are standard time, or daylight saving time, the local time after the transition is used.

ICU Status
Stable since ICU 69.
flagValback to summary
private int flagVal
FORMERback to summary
public static final BasicTimeZone.LocalOption FORMER

An input time is always interpreted as local time before a time zone transition.

ICU Status
Stable since ICU 69.
LATTERback to summary
public static final BasicTimeZone.LocalOption LATTER

An input time is always interpreted as local time after a time zone transition.

ICU Status
Stable since ICU 69.
STANDARD_FORMERback to summary
public static final BasicTimeZone.LocalOption STANDARD_FORMER

An input time is interpreted as standard time when local time is switched to/from daylight saving time. When both sides of a time zone transition are standard time, or daylight saving time, the local time before the transition is used.

ICU Status
Stable since ICU 69.
STANDARD_LATTERback to summary
public static final BasicTimeZone.LocalOption STANDARD_LATTER

An input time is interpreted as standard time when local time is switched to/from daylight saving time. When both sides of a time zone transition are standard time, or daylight saving time, the local time after the transition is used.

ICU Status
Stable since ICU 69.

Constructor Detail

LocalOptionback to summary
private LocalOption(int flagVal)

Method Detail

valueOfback to summary
public static BasicTimeZone.LocalOption valueOf(String name)
valuesback to summary
public static BasicTimeZone.LocalOption[] values()