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

public abstract Class TimeZoneRule

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
com.ibm.icu.util.InitialTimeZoneRule, com.ibm.icu.util.AnnualTimeZoneRule, com.ibm.icu.util.TimeArrayTimeZoneRule
Imports
java.io.Serializable, java.util.Date

TimeZoneRule is an abstract class representing a rule for time zone. TimeZoneRule has a set of time zone attributes, such as zone name, raw offset (UTC offset for standard time) and daylight saving time offset.
ICU Status
Stable since ICU 3.8.
See Also
com.ibm.icu.util.TimeZoneTransition, com.ibm.icu.util.RuleBasedTimeZone

Field Summary

Modifier and TypeField and Description
private final int
private final String
private final int
private static final long

Constructor Summary

AccessConstructor and Description
public
TimeZoneRule(String
The time zone name.
name
,
int
The UTC offset of its standard time in milliseconds.
rawOffset
,
int
The amount of daylight saving offset adjustment in milliseconds. If this is a rule for standard time, the value of this argument is 0.
dstSavings
)

Constructs a TimeZoneRule with the name, the GMT offset of its standard time and the amount of daylight saving offset adjustment.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The amount of daylight saving offset used by this rule in milliseconds.
getDSTSavings
()

Gets the amount of daylight saving delta time from the standard time.

public abstract Date

Returns:

The very last time when this rule takes effect, or null if this rule is applied for future dates infinitely.
getFinalStart
(int
The standard time offset from UTC before this rule takes effect in milliseconds.
prevRawOffset
,
int
The amount of daylight saving offset from the standard time.
prevDSTSavings
)

Gets the final time when this rule takes effect.

public abstract Date

Returns:

The very first time when this rule takes effect.
getFirstStart
(int
The standard time offset from UTC before this rule takes effect in milliseconds.
prevRawOffset
,
int
The amount of daylight saving offset from the standard time.
prevDSTSavings
)

Gets the very first time when this rule takes effect.

public String

Returns:

The name of this time zone.
getName
()

Gets the name of this time zone.

public abstract Date

Returns:

The first time when this rule takes effect after the specified time, or null when this rule never takes effect after the specified time.
getNextStart
(long
The first time after this time is returned.
base
,
int
The standard time offset from UTC before this rule takes effect in milliseconds.
prevRawOffset
,
int
The amount of daylight saving offset from the standard time.
prevDSTSavings
,
boolean
Whether the base time is inclusive or not.
inclusive
)

Gets the first time when this rule takes effect after the specified time.

public abstract Date

Returns:

The most recent time when this rule takes effect before the specified time, or null when this rule never takes effect before the specified time.
getPreviousStart
(long
The most recent time when this rule takes effect before this time is returned.
base
,
int
The standard time offset from UTC before this rule takes effect in milliseconds.
prevRawOffset
,
int
The amount of daylight saving offset from the standard time.
prevDSTSavings
,
boolean
Whether the base time is inclusive or not.
inclusive
)

Gets the most recent time when this rule takes effect before the specified time.

public int

Returns:

The standard time offset from UTC in milliseconds.
getRawOffset
()

Gets the standard time offset.

public boolean

Returns:

true if the other TimeZoneRule is the same as this one.
isEquivalentTo
(TimeZoneRule
The TimeZoneRule object to be compared with.
other
)

Returns if this rule represents the same rule and offsets as another.

public abstract boolean

Returns:

true if this TimeZoneRule has one or more start times.
isTransitionRule
()

Returns if this TimeZoneRule has one or more start times.

public String
toString()

Overrides java.lang.Object.toString.

Returns a String representation of this TimeZoneRule object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

dstSavingsback to summary
private final int dstSavings
nameback to summary
private final String name
rawOffsetback to summary
private final int rawOffset
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

TimeZoneRuleback to summary
public TimeZoneRule(String name, int rawOffset, int dstSavings)

Constructs a TimeZoneRule with the name, the GMT offset of its standard time and the amount of daylight saving offset adjustment.

Parameters
name:String

The time zone name.

rawOffset:int

The UTC offset of its standard time in milliseconds.

dstSavings:int

The amount of daylight saving offset adjustment in milliseconds. If this is a rule for standard time, the value of this argument is 0.

ICU Status
Stable since ICU 3.8.

Method Detail

getDSTSavingsback to summary
public int getDSTSavings()

Gets the amount of daylight saving delta time from the standard time.

Returns:int

The amount of daylight saving offset used by this rule in milliseconds.

ICU Status
Stable since ICU 3.8.
getFinalStartback to summary
public abstract Date getFinalStart(int prevRawOffset, int prevDSTSavings)

Gets the final time when this rule takes effect.

Parameters
prevRawOffset:int

The standard time offset from UTC before this rule takes effect in milliseconds.

prevDSTSavings:int

The amount of daylight saving offset from the standard time.

Returns:Date

The very last time when this rule takes effect, or null if this rule is applied for future dates infinitely.

ICU Status
Stable since ICU 3.8.
getFirstStartback to summary
public abstract Date getFirstStart(int prevRawOffset, int prevDSTSavings)

Gets the very first time when this rule takes effect.

Parameters
prevRawOffset:int

The standard time offset from UTC before this rule takes effect in milliseconds.

prevDSTSavings:int

The amount of daylight saving offset from the standard time.

Returns:Date

The very first time when this rule takes effect.

ICU Status
Stable since ICU 3.8.
getNameback to summary
public String getName()

Gets the name of this time zone.

Returns:String

The name of this time zone.

ICU Status
Stable since ICU 3.8.
getNextStartback to summary
public abstract Date getNextStart(long base, int prevRawOffset, int prevDSTSavings, boolean inclusive)

Gets the first time when this rule takes effect after the specified time.

Parameters
base:long

The first time after this time is returned.

prevRawOffset:int

The standard time offset from UTC before this rule takes effect in milliseconds.

prevDSTSavings:int

The amount of daylight saving offset from the standard time.

inclusive:boolean

Whether the base time is inclusive or not.

Returns:Date

The first time when this rule takes effect after the specified time, or null when this rule never takes effect after the specified time.

ICU Status
Stable since ICU 3.8.
getPreviousStartback to summary
public abstract Date getPreviousStart(long base, int prevRawOffset, int prevDSTSavings, boolean inclusive)

Gets the most recent time when this rule takes effect before the specified time.

Parameters
base:long

The most recent time when this rule takes effect before this time is returned.

prevRawOffset:int

The standard time offset from UTC before this rule takes effect in milliseconds.

prevDSTSavings:int

The amount of daylight saving offset from the standard time.

inclusive:boolean

Whether the base time is inclusive or not.

Returns:Date

The most recent time when this rule takes effect before the specified time, or null when this rule never takes effect before the specified time.

ICU Status
Stable since ICU 3.8.
getRawOffsetback to summary
public int getRawOffset()

Gets the standard time offset.

Returns:int

The standard time offset from UTC in milliseconds.

ICU Status
Stable since ICU 3.8.
isEquivalentToback to summary
public boolean isEquivalentTo(TimeZoneRule other)

Returns if this rule represents the same rule and offsets as another. When two TimeZoneRule objects differ only its names, this method returns true.

Parameters
other:TimeZoneRule

The TimeZoneRule object to be compared with.

Returns:boolean

true if the other TimeZoneRule is the same as this one.

ICU Status
Stable since ICU 3.8.
isTransitionRuleback to summary
public abstract boolean isTransitionRule()

Returns if this TimeZoneRule has one or more start times.

Returns:boolean

true if this TimeZoneRule has one or more start times.

ICU Status
Stable since ICU 3.8.
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a String representation of this TimeZoneRule object. This method is used for debugging purpose only. The string representation can be changed in future version of ICU without any notice.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.

Annotations
@Override
ICU Status
Stable since ICU 3.8.