cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vlr516
Helper I
Helper I

Scheduled Flow using UTC and Daylight Savings Time EST

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)?

 

Thanks. 

 

 

4 REPLIES 4
PrasadAthalye
Super User
Super User

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.

PrasadAthalye_0-1615851926511.png

 

For the midnight next day, can you use the following logic? 

PrasadAthalye_2-1615852638758.png

formatDateTime(addDays(body('Convert_time_zone'), 1), 'yyyy-MM-ddTHH:mm:ss')

 

PrasadAthalye_1-1615852612365.png

 

 

 

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

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.

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (64,406)