Summer time formulas (aka DST)

Posting here in case it’s useful, and for my own future reference :wink:

Simple-ish formulas to check if summer time is in force:

Europe (CEST):

DateTimeField >=
  Date(Year(DateTimeField), 4, 1) -
    Days(IsoWeekday(Date(Year(DateTimeField), 4, 1))) +
    Hours(1) and
  DateTimeField <
    Date(Year(DateTimeField), 11, 1) -
      Days(IsoWeekday(Date(Year(DateTimeField), 11, 1))) +
      Hours(1)

US:

DateTimeField >=
  Date(Year(DateTimeField), 3, 1) +
    Days(14 - IsoWeekday(Date(Year(DateTimeField), 3, 1))) +
    Hours(Delta + 2) and
  DateTimeField <
    Date(Year(DateTimeField), 11, 1) +
      Days(7 - IsoWeekday(Date(Year(DateTimeField), 11, 1))) +
      Hours(Delta + 2)

where Delta is time difference in winter from UTC (e.g. 5 for Eastern US)

Australia:

DateTimeField >=
  Date(Year(DateTimeField), 10, 8) -
    Days(IsoWeekday(Date(Year(DateTimeField), 10, 8))) -
    Hours(8) or
  DateTimeField <
    Date(Year(DateTimeField), 4, 8) -
      Days(IsoWeekday(Date(Year(DateTimeField), 4, 8))) -
      Hours(8)

or

DateTimeField >=
  Date(Year(DateTimeField), 10, 8) -
    Days(IsoWeekday(Date(Year(DateTimeField), 10, 8))) -
    Hours(7) -
    Minutes(30) or
  DateTimeField <
    Date(Year(DateTimeField), 4, 8) -
      Days(IsoWeekday(Date(Year(DateTimeField), 4, 8))) -
      Hours(7) -
      Minutes(30)

depending on whether you’re in New South Wales, ACT, Victoria and Tasmania, or in South Australia (or the the New South Wales town of Broken Hill(!) )

1 Like