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
------------------------------
Original Message:
Sent: 05-02-2025 11:30
From: Rudy Reinold
Subject: Determine last Sunday in March and October
We want to enable the callback features between specific hours of the day, I found however that during summer time the current schedule is an hour off due to the time shift and therefore had to manually update all the corresponding times. I would like to be able in architect flows to automate this so we don't have to change every time the tables that hold the times. We know the BST kicks in on the last Sunday of March and ends the last Sunday of October. What is the best way to identify these days within a flow?
#Architect
------------------------------
Ruud Reinold
BNP Paribas Personal Finance UK
------------------------------