Class GregorianTimezoneRule

java.lang.Object
net.time4j.tz.model.DaylightSavingRule
net.time4j.tz.model.GregorianTimezoneRule
All Implemented Interfaces:
Serializable

@CalendarType("iso8601") public class GregorianTimezoneRule extends DaylightSavingRule implements 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 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 month
      dayOfMonth - day of month (1 - 31)
      timeOfDay - clock time when time switch happens
      indicator - offset indicator
      savings - 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 month
      dayOfMonth - day of month (1 - 31)
      timeOfDay - clock time in seconds after midnight when time switch happens
      indicator - offset indicator
      savings - 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 month
      dayOfWeek - last day of week
      timeOfDay - clock time in seconds after midnight when time switch happens
      indicator - offset indicator
      savings - 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 month
      dayOfWeek - last day of week
      timeOfDay - clock time in seconds after midnight when time switch happens
      indicator - offset indicator
      savings - 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 month
      dayOfMonth - reference day of month (1 - 31)
      dayOfWeek - day of week when time switch happens
      timeOfDay - clock time when time switch happens
      indicator - offset indicator
      savings - 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 month
      dayOfMonth - reference day of month (1 - 31)
      dayOfWeek - day of week when time switch happens
      timeOfDay - clock time in seconds after midnight when time switch happens
      indicator - offset indicator
      savings - 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 month
      dayOfMonth - reference day of month (1 - 31)
      dayOfWeek - day of week when time switch happens
      timeOfDay - clock time when time switch happens
      indicator - offset indicator
      savings - 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 month
      dayOfMonth - reference day of month (1 - 31)
      dayOfWeek - day of week when time switch happens
      timeOfDay - clock time in seconds after midnight when time switch happens
      indicator - offset indicator
      savings - 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

      public final PlainDate getDate(int year)
      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 class DaylightSavingRule
      Parameters:
      year - reference year when a time switch happens
      Returns:
      calendar date of time switch
    • getMonth

      public Month getMonth()

      Yields the gregorian month of time switch.

      Returns:
      month
      Since:
      3.1