I have this automation flow where I need to calculate past and present days dates based on the current date. I might have been able to capture them but they are not based on my timezone. If I run it at 7 AM, Tuesday, and try to get the current day
dayOfWeek(utcNow()), it returns a value of Monday. But when I run it again on 8 AM, it would return the correct day which is Tuesday.
I have these expressions to calculate next week's date:
Monday - addDays(utcNow(), sub(8, dayOfWeek(addHours(utcNow(), 8))), 'yyyy-MM-dd')
Tuesday - addDays(utcNow(), sub(9, dayOfWeek(addHours(utcNow(), 8))), 'yyyy-MM-dd')
Wednesday - addDays(utcNow(), sub(10, dayOfWeek(addHours(utcNow(), 8))), 'yyyy-MM-dd')
Thursday - addDays(utcNow(), sub(11, dayOfWeek(addHours(utcNow(), 8))), 'yyyy-MM-dd')
Friday - addDays(utcNow(), sub(12, dayOfWeek(addHours(utcNow(), 8))), 'yyyy-MM-dd')
which when run on specific times of the day, also returns the previous day's date, like the behavior exhibited by my dayOfWeek(utcNow())