Showing results for 
Search instead for 
Did you mean: 

Time to make the donuts!

Hi, Flow fans! 


My name is Sandy Ussia, and this is my first post in the Flow Community blog, though I've been fairly active in the past year answering questions in the forums and speaking about Flow at SharePoint events. My favorite thing is puzzling out how to do something, as long as it can be done without getting into code Smiley Happy


I ran across this question in the Flow Community forums recently, and thought it was a very interesting problem: How can I run a Flow at sunrise each day? Perhaps you need a reminder of something each day based on the sunrise (or sunset)... milk the cows, say your prayers, make the donuts...whatever. It's simple enough to have a Flow run at a certain time each day, using the Recurrence trigger, but how to have it run based on a changeable thing like the time the sun rises wherever you happen to be?


The idea I had was to make use of the MSN Weather connector, which among other things can tell you the sunrise time today. So... every Flow must have a trigger of some sort, something that sets it off. Unfortunately, the two triggers available with the MSN Weather connector are only related to the current weather (i.e. When the current conditions change, and When the current weather changes). However, the sunrise and sunset times (and lots of other things) are available in the weather forecast coming from this connector. But that's an Action: Get forecast for today. Meaning it can only be used within a Flow that's already been triggered. So for a trigger, I chose Recurrence - what I did here was set it to trigger daily at some hour before sunrise, e.g. 4am. You just need to be sure to select your time zone (I happen to be in Costa Rica right now), and select an hour from the checkboxes it gives you in At these hoursDaily at 4a.png


Next is the MSN Weather action Get forecast for today. Here, you specify the location, and the unit of measure you want to use (Imperial or Metric, i.e. F vs C temp). You can just type in a city and country, or enter a longitude and latitude, or various other things (there's a tip in the box about that).Get forecast for today.png

This action returns all sorts of interesting information!  


In the next step, I found I needed to do a bit of trickery with the value that came back from MSN Weather for the sunrise time. It came back in a format like 2018-04-16T11:25:50+00:00, but the following step needed it to be in standard UTC format like 2018-04-16T11:25:50Z. So the Compose action uses an expression to modify the text: 


I created the expression by using the Expression Builder, but the above is what comes out of it. Basically, I'm getting the first 19 characters of the sunset time, i.e. removing the +00:00 from the end. In Expression Builder, I selected the substring function, and then inside the () I went back to Dynamic Data and selected the Sunrise time from the Get forecast for today action. The substring function then requires a beginning position (0 in this case, for the first character) and a number of characters after that (19 in this case, counting the characters up to the + in the datetime coming back from MSN Weather).



Compose sunrise time.png



The next action is Delay Until, which pauses the Flow until a certain time. Here, the time is the Output of the Compose step, with a Z added to the end to meet the format requirement.Delay until sunrise.png


Something to be aware of is that all datetime outputs of a Flow action are in UTC time. So while the sunrise value of the MSN Weather action was 11:25, that equated to the actual sunrise time here in Costa Rica of 5:25am.


And then after that you can do whatever actions you want to do. I just sent myself a mobile notification, which buzzed my phone at 5:25am as the sun was coming up over the mountains and the birds were singing Smiley Happy


Send notification.png

So here's an overview of this Flow... Trigger on sunrise overview.png




I hope this has been useful to get you thinking of some other similar scenarios when there isn't the exact trigger available that you need.



Hello Sandy!


I was creating my own Flow that would send a notification at sun rise and sunset just to test out the parrallel branches. When my flow failed because of the timestamps not being in the proper format I looked to the community and found your solution. As I was editing mine to reflect your solution, I thought of a way to possibly simplifiy it another step.

composing_versus_concatenation.PNG For sunrise's alert I have your suggested solution of composing the substring and then having delay until call on the substring. On sunset's side of the Flow I used 

concat(substring(body('Get_forecast_for_today')?['responses']?['almanac']?['sunset'],0,19), 'Z')

to add the 'Z' to the rest of the timestamp all at once. 
Just thought I'd share back with you!

Nice, @Anonymous 🙂

Oh, hey! You're from near my hometown of Pittsburgh! (though technically I no longer live there)

@SandyUwill I need premium to make this work?


Thank you 🙂

Hi @Foreverhealthy 

No, all of the connectors in this flow are standard, no premium plan required!


About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: and twitter I also write at, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – Youtube channel -