Hi Rudy,
We've recently implemented this in a Digital Bot to handle callback availability across different times of the year, and I ran into the exact challenge you're describing - adjusting for daylight saving time without needing to manually update schedules or tables every time the clock shifts.
To handle this, we use GetDayOfWeekOccurrence() to calculate whether DST is active (based on the first Sunday of October and April for us in Australia), and use that in our Architect flow logic to adjust the callback schedule accordingly.
Below is the full example snippet we use to determine to enable callbacks between 11am–12pm Melbourne time, dynamically accounting for DST (AEDT/AEST in our case). Hope this helps.
If(
Hour(Flow.LocalDateTime) < 11,
MakeDateTime(
Year(Flow.LocalDateTime),
Month(Flow.LocalDateTime),
Day(Flow.LocalDateTime),
If(
Flow.LocalDateTime >= GetDayOfWeekOccurrence(1,1,Year(Flow.LocalDateTime)-1,10,1,2,0)
And Flow.LocalDateTime < GetDayOfWeekOccurrence(1,1,Year(Flow.LocalDateTime),4,1,3,0),
0,
If(
Flow.LocalDateTime >= GetDayOfWeekOccurrence(1,1,Year(Flow.LocalDateTime),10,1,2,0),
0,
1
)
),
Minute(Flow.LocalDateTime),
0
),
If(
(Day(AddDays(Flow.LocalDateTime, 1)) < Day(Flow.LocalDateTime)
And DayOfWeek(AddDays(Flow.LocalDateTime, 1)) >= 2
And DayOfWeek(AddDays(Flow.LocalDateTime, 1)) <= 5),
MakeDateTime(
Year(AddDays(Flow.LocalDateTime, 1)),
Month(AddDays(Flow.LocalDateTime, 1)),
Day(AddDays(Flow.LocalDateTime, 1)),
If(
AddDays(Flow.LocalDateTime,1) >= GetDayOfWeekOccurrence(1,1,Year(AddDays(Flow.LocalDateTime,1))-1,10,1,2,0)
And AddDays(Flow.LocalDateTime,1) < GetDayOfWeekOccurrence(1,1,Year(AddDays(Flow.LocalDateTime,1)),4,1,3,0),
0,
If(
AddDays(Flow.LocalDateTime,1) >= GetDayOfWeekOccurrence(1,1,Year(AddDays(Flow.LocalDateTime,1)),10,1,2,0),
0,
1
)
),
Minute(Flow.LocalDateTime),
0
),
If(
(DayOfWeek(Flow.LocalDateTime) == 6 And Hour(Flow.LocalDateTime) >= 11)
Or (DayOfWeek(Flow.LocalDateTime) == 6 And Day(AddDays(Flow.LocalDateTime, 3)) < Day(Flow.LocalDateTime)),
MakeDateTime(
Year(AddDays(Flow.LocalDateTime, 3)),
Month(AddDays(Flow.LocalDateTime, 3)),
Day(AddDays(Flow.LocalDateTime, 3)),
If(
AddDays(Flow.LocalDateTime,3) >= GetDayOfWeekOccurrence(1,1,Year(AddDays(Flow.LocalDateTime,3))-1,10,1,2,0)
And AddDays(Flow.LocalDateTime,3) < GetDayOfWeekOccurrence(1,1,Year(AddDays(Flow.LocalDateTime,3)),4,1,3,0),
0,
If(
AddDays(Flow.LocalDateTime,3) >= GetDayOfWeekOccurrence(1,1,Year(AddDays(Flow.LocalDateTime,3)),10,1,2,0),
0,
1
)
),
Minute(Flow.LocalDateTime),
0
),
If(
(DayOfWeek(Flow.LocalDateTime) == 7)
Or (DayOfWeek(Flow.LocalDateTime) == 7 And Day(AddDays(Flow.LocalDateTime, 2)) < Day(Flow.LocalDateTime)),
MakeDateTime(
Year(AddDays(Flow.LocalDateTime, 2)),
Month(AddDays(Flow.LocalDateTime, 2)),
Day(AddDays(Flow.LocalDateTime, 2)),
If(
AddDays(Flow.LocalDateTime,2) >= GetDayOfWeekOccurrence(1,1,Year(AddDays(Flow.LocalDateTime,2))-1,10,1,2,0)
And AddDays(Flow.LocalDateTime,2) < GetDayOfWeekOccurrence(1,1,Year(AddDays(Flow.LocalDateTime,2)),4,1,3,0),
0,
If(
AddDays(Flow.LocalDateTime,2) >= GetDayOfWeekOccurrence(1,1,Year(AddDays(Flow.LocalDateTime,2)),10,1,2,0),
0,
1
)
),
Minute(Flow.LocalDateTime),
0
),
If(
(DayOfWeek(Flow.LocalDateTime) == 1)
Or (DayOfWeek(Flow.LocalDateTime) == 1 And Day(AddDays(Flow.LocalDateTime, 1)) < Day(Flow.LocalDateTime)),
MakeDateTime(
Year(AddDays(Flow.LocalDateTime, 1)),
Month(AddDays(Flow.LocalDateTime, 1)),
Day(AddDays(Flow.LocalDateTime, 1)),
If(
AddDays(Flow.LocalDateTime,1) >= GetDayOfWeekOccurrence(1,1,Year(AddDays(Flow.LocalDateTime,1))-1,10,1,2,0)
And AddDays(Flow.LocalDateTime,1) < GetDayOfWeekOccurrence(1,1,Year(AddDays(Flow.LocalDateTime,1)),4,1,3,0),
0,
If(
AddDays(Flow.LocalDateTime,1) >= GetDayOfWeekOccurrence(1,1,Year(AddDays(Flow.LocalDateTime,1)),10,1,2,0),
0,
1
)
),
Minute(Flow.LocalDateTime),
0
),
If(
Hour(Flow.LocalDateTime) >= 11,
MakeDateTime(
Year(AddDays(Flow.LocalDateTime, 1)),
Month(AddDays(Flow.LocalDateTime, 1)),
Day(AddDays(Flow.LocalDateTime, 1)),
If(
AddDays(Flow.LocalDateTime,1) >= GetDayOfWeekOccurrence(1,1,Year(AddDays(Flow.LocalDateTime,1))-1,10,1,2,0)
And AddDays(Flow.LocalDateTime,1) < GetDayOfWeekOccurrence(1,1,Year(AddDays(Flow.LocalDateTime,1)),4,1,3,0),
0,
If(
AddDays(Flow.LocalDateTime,1) >= GetDayOfWeekOccurrence(1,1,Year(AddDays(Flow.LocalDateTime,1)),10,1,2,0),
0,
1
)
),
Minute(Flow.LocalDateTime),
0
),
MakeDateTime(
Year(Flow.LocalDateTime),
Month(Flow.LocalDateTime),
Day(Flow.LocalDateTime),
If(
Flow.LocalDateTime >= GetDayOfWeekOccurrence(1,1,Year(Flow.LocalDateTime)-1,10,1,2,0)
And Flow.LocalDateTime < GetDayOfWeekOccurrence(1,1,Year(Flow.LocalDateTime),4,1,3,0),
0,
If(
Flow.LocalDateTime >= GetDayOfWeekOccurrence(1,1,Year(Flow.LocalDateTime),10,1,2,0),
0,
1
)
),
Minute(Flow.LocalDateTime),
0
)
)
)
)
)
)
)
------------------------------
Phaneendra
Technical Solutions Consultant
Monash University
Australia
------------------------------