I have a flow that a user can choose what time to trigger the flow to grab tomorrow's calendar schedule. If I schedule the flow at 3pm EST, everything works fine. If I schedule the flow at 7pm EST, then I run into a problem with UTC.
I set a variable called PullStartTime. PullStartTime should begin at midnight the upcoming day. IE: today is 3/15/21. I want PullStartTime to be 3/16/21
The expression used is: convertTimeZone(startOfDay(utcNow('dd MMM yyyy),1), 'hh:mm tt dd MMM yyyy'), variables('UserTimeZone'), 'UTC')
The problem is if the flow is triggered at 7pm EST, the UTC = midnight. Because of the the UTC, instead of PullStartTime equaling 3/16/21, it jumps forward to 3/17/21.
How do I eliminate this so no matter what timezone, the PullStartTime will be the next day of when the flow was triggered.
Lastly, how do I solve for Daylight Savings Time. Is there a value I should use besides "Eastern Standard Time" to note that we have just moved from (UTC -5:00) to (UTC -4:00)?
Daylight savings should be an automatic switch as far as the trigger is concerned. I have a flow that runs every day at 7:15 PM. After daylight saving time changed, it still runs exactly at the same time. Refer below screen shot as its running at the moment.
For the midnight next day, can you use the following logic?
The issue isn't the time it triggers, it is what the PullStartTime expression thinks is the "next day". With my current expression for PullStartTime (which is not the same as the scheduled trigger), the capture of utcNow at 7pm EST is 12am UTC. That then sets my PullStartTime really 2 calendar days ahead than what I get when scheduling the trigger before 7pm which would be the next calendar day.
Do you think the above would still work in my situation?
Maybe I'm looking at it wrong. Is there a way to capture the date based on my time zone vs UTC? Then maybe I create some expression that would add 1 day to the date for PullStartTime. ...Just thinking out loud.
I understand the issue with UTC. That is the exact reason I am suggesting converting UTC back to Eastern time. That way It will be always today's date without the time factor. Then I am just adding 1 day so that it becomes tomorrow's date and time remains 00 which is midnight.
Check out how to claim yours today!
Check out new user group experience and if you are a leader please create your group
Test your skills now with the Cloud Skill Challenge.