Class GregorianTimezoneRule
- All Implemented Interfaces:
Serializable
Represents a standard daylight saving rule following the gregorian calendar as used in IANA-TZDB.
- Since:
- 2.2
- Author:
- Meno Hochschild
- See Also:
- Serialized Form
-
Method Summary
Modifier and TypeMethodDescriptiongetDate(int year)
Determines the date of time switch dependent on given year.getMonth()
Yields the gregorian month of time switch.static GregorianTimezoneRule
ofFixedDay(Month month, int dayOfMonth, int timeOfDay, OffsetIndicator indicator, int savings)
Creates a rule for a fixed day in given month.static GregorianTimezoneRule
ofFixedDay(Month month, int dayOfMonth, PlainTime timeOfDay, OffsetIndicator indicator, int savings)
Creates a rule for a fixed day in given month.static GregorianTimezoneRule
ofLastWeekday(Month month, Weekday dayOfWeek, int timeOfDay, OffsetIndicator indicator, int savings)
Creates a rule for the last day of week in given month.static GregorianTimezoneRule
ofLastWeekday(Month month, Weekday dayOfWeek, PlainTime timeOfDay, OffsetIndicator indicator, int savings)
Creates a rule for the last day of week in given month.static GregorianTimezoneRule
ofWeekdayAfterDate(Month month, int dayOfMonth, Weekday dayOfWeek, int timeOfDay, OffsetIndicator indicator, int savings)
Creates a rule for a day of week after the given reference date.static GregorianTimezoneRule
ofWeekdayAfterDate(Month month, int dayOfMonth, Weekday dayOfWeek, PlainTime timeOfDay, OffsetIndicator indicator, int savings)
Creates a rule for a day of week after the given reference date.static GregorianTimezoneRule
ofWeekdayBeforeDate(Month month, int dayOfMonth, Weekday dayOfWeek, int timeOfDay, OffsetIndicator indicator, int savings)
Creates a rule for a day of week before the given reference date.static GregorianTimezoneRule
ofWeekdayBeforeDate(Month month, int dayOfMonth, Weekday dayOfWeek, PlainTime timeOfDay, OffsetIndicator indicator, int savings)
Creates a rule for a day of week before the given reference date.Methods inherited from class net.time4j.tz.model.DaylightSavingRule
getIndicator, getSavings, getTimeOfDay
-
Method Details
-
ofFixedDay
public static GregorianTimezoneRule ofFixedDay(Month month, int dayOfMonth, PlainTime timeOfDay, OffsetIndicator indicator, int savings)Creates a rule for a fixed day in given month.
- Parameters:
month
- calendar monthdayOfMonth
- day of month (1 - 31)timeOfDay
- clock time when time switch happensindicator
- offset indicatorsavings
- fixed DST-offset in seconds- Returns:
- new daylight saving rule
- Throws:
IllegalArgumentException
- if the last argument is out of range or if the day of month is not valid in context of given month- Since:
- 2.2
-
ofFixedDay
public static GregorianTimezoneRule ofFixedDay(Month month, int dayOfMonth, int timeOfDay, OffsetIndicator indicator, int savings)Creates a rule for a fixed day in given month.
- Parameters:
month
- calendar monthdayOfMonth
- day of month (1 - 31)timeOfDay
- clock time in seconds after midnight when time switch happensindicator
- offset indicatorsavings
- fixed DST-offset in seconds- Returns:
- new daylight saving rule
- Throws:
IllegalArgumentException
- if the last argument is out of range or if the day of month is not valid in context of given month- Since:
- 5.0
-
ofLastWeekday
public static GregorianTimezoneRule ofLastWeekday(Month month, Weekday dayOfWeek, PlainTime timeOfDay, OffsetIndicator indicator, int savings)Creates a rule for the last day of week in given month.
- Parameters:
month
- calendar monthdayOfWeek
- last day of weektimeOfDay
- clock time in seconds after midnight when time switch happensindicator
- offset indicatorsavings
- fixed DST-offset in seconds- Returns:
- new daylight saving rule
- Throws:
IllegalArgumentException
- if the last argument is out of range- Since:
- 2.2
-
ofLastWeekday
public static GregorianTimezoneRule ofLastWeekday(Month month, Weekday dayOfWeek, int timeOfDay, OffsetIndicator indicator, int savings)Creates a rule for the last day of week in given month.
- Parameters:
month
- calendar monthdayOfWeek
- last day of weektimeOfDay
- clock time in seconds after midnight when time switch happensindicator
- offset indicatorsavings
- fixed DST-offset in seconds- Returns:
- new daylight saving rule
- Throws:
IllegalArgumentException
- if the last argument is out of range- Since:
- 5.0
-
ofWeekdayAfterDate
public static GregorianTimezoneRule ofWeekdayAfterDate(Month month, int dayOfMonth, Weekday dayOfWeek, PlainTime timeOfDay, OffsetIndicator indicator, int savings)Creates a rule for a day of week after the given reference date.
Example => You have to set for the second Sunday in April:
month=APRIL, dayOfMonth=8, dayOfWeek=SUNDAY
.- Parameters:
month
- calendar monthdayOfMonth
- reference day of month (1 - 31)dayOfWeek
- day of week when time switch happenstimeOfDay
- clock time when time switch happensindicator
- offset indicatorsavings
- fixed DST-offset in seconds- Returns:
- new daylight saving rule
- Throws:
IllegalArgumentException
- if the last argument is out of range or if the day of month is not valid in context of given month- Since:
- 2.2
-
ofWeekdayAfterDate
public static GregorianTimezoneRule ofWeekdayAfterDate(Month month, int dayOfMonth, Weekday dayOfWeek, int timeOfDay, OffsetIndicator indicator, int savings)Creates a rule for a day of week after the given reference date.
Example => You have to set for the second Sunday in April:
month=APRIL, dayOfMonth=8, dayOfWeek=SUNDAY
.- Parameters:
month
- calendar monthdayOfMonth
- reference day of month (1 - 31)dayOfWeek
- day of week when time switch happenstimeOfDay
- clock time in seconds after midnight when time switch happensindicator
- offset indicatorsavings
- fixed DST-offset in seconds- Returns:
- new daylight saving rule
- Throws:
IllegalArgumentException
- if the last argument is out of range or if the day of month is not valid in context of given month- Since:
- 5.0
-
ofWeekdayBeforeDate
public static GregorianTimezoneRule ofWeekdayBeforeDate(Month month, int dayOfMonth, Weekday dayOfWeek, PlainTime timeOfDay, OffsetIndicator indicator, int savings)Creates a rule for a day of week before the given reference date.
- Parameters:
month
- calendar monthdayOfMonth
- reference day of month (1 - 31)dayOfWeek
- day of week when time switch happenstimeOfDay
- clock time when time switch happensindicator
- offset indicatorsavings
- fixed DST-offset in seconds- Returns:
- new daylight saving rule
- Throws:
IllegalArgumentException
- if the last argument is out of range or if the day of month is not valid in context of given month- Since:
- 2.2
-
ofWeekdayBeforeDate
public static GregorianTimezoneRule ofWeekdayBeforeDate(Month month, int dayOfMonth, Weekday dayOfWeek, int timeOfDay, OffsetIndicator indicator, int savings)Creates a rule for a day of week before the given reference date.
- Parameters:
month
- calendar monthdayOfMonth
- reference day of month (1 - 31)dayOfWeek
- day of week when time switch happenstimeOfDay
- clock time in seconds after midnight when time switch happensindicator
- offset indicatorsavings
- fixed DST-offset in seconds- Returns:
- new daylight saving rule
- Throws:
IllegalArgumentException
- if the last argument is out of range or if the day of month is not valid in context of given month- Since:
- 5.0
-
getDate
Description copied from class:DaylightSavingRule
Determines the date of time switch dependent on given year.
The result must be interpreted by mean of
DaylightSavingRule.getIndicator()
in order to calculate the UTC date.- Specified by:
getDate
in classDaylightSavingRule
- Parameters:
year
- reference year when a time switch happens- Returns:
- calendar date of time switch
-
getMonth
Yields the gregorian month of time switch.
- Returns:
- month
- Since:
- 3.1
-