Class DaylightSavingRule
- Direct Known Subclasses:
GregorianTimezoneRule
Defines a yearly pattern when and how there is a switch from winter to summer time and vice versa.
This rule describes when such a switch happens. It also determines
the DST-offset. For every rule instance, a ZonalTransition
can
be created just by indicating the appropriate year and standard offset.
The change from winter to summer time and back is usually expressed
by two rule instances.
Note: The term "year" denotes the year in any calendar which is not necessarily the gregorian one. Subclasses need to define the calendar type and some calendar-specific year conversions. If subclasses also want to be serializable then they have to apply the serialization proxy pattern described by Joshua Bloch.
- Since:
- 2.2
- Author:
- Meno Hochschild
-
Method Summary
Modifier and TypeMethodDescriptionabstract PlainDate
getDate(int year)
Determines the date of time switch dependent on given year.Yields the offset indicator which must be consulted when interpreting the date and time of time switch in terms of UTC.int
Yields the daylight saving amount after the time switch in seconds.Determines the clock time when the switch from winter time to summer time happens or vice versa.
-
Method Details
-
getDate
Determines the date of time switch dependent on given year.
The result must be interpreted by mean of
getIndicator()
in order to calculate the UTC date.- Parameters:
year
- reference year when a time switch happens- Returns:
- calendar date of time switch
- Throws:
IllegalArgumentException
- if given year does not fit to this rule- Since:
- 2.2
-
getTimeOfDay
Determines the clock time when the switch from winter time to summer time happens or vice versa.
The result must be interpreted by mean of
getIndicator()
in order to calculate the UTC time.- Returns:
- clock time of time switch in second precision
- Since:
- 2.2
-
getIndicator
Yields the offset indicator which must be consulted when interpreting the date and time of time switch in terms of UTC.
- Returns:
- OffsetIndicator
- Since:
- 2.2
-
getSavings
public final int getSavings()Yields the daylight saving amount after the time switch in seconds.
Important: This offset is not always positive but can also be zero or even negative.
- Returns:
- DST-Offset in seconds (without standard offset)
- Since:
- 2.2
-