cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Alienvolm
Advocate II
Advocate II

Function that checks time of day

Hi, 

 

I'm a total newbie, so please forgive if this is a stupid question...

 

I have a flow that needs to run twice a day and is triggered by recurrence. The flow saves a Power Bi report as a file in a shared location and feeds another flow in a Logic App. It used to run once a day and it works just fine. However, now we need to run it twice a day and we need to rename the file with the suffix 1 if it runs in the morning and 2 if it runs in the afternoon. 

 

I thought to add a simple variable that returns 1 or 2 based on that, but I can't get the function right to do that... 

 

Here is my flow:

 

Alienvolm_0-1625754696446.png

 

My thought process would be to add as a Value of the Initialize Variable something like this: 

 

 

if (formatDateTime(utcNow(), 'HH:mm') <= 09:30, 1, 2)

 

 

However, the syntax is wrong... Can someone point me to the right direction? 

 

Thanks a million! 

 

~Alienvolm

1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User
Super User

Hi @Alienvolm 

 

Try the below

 

if(less(int(formatDateTime(utcNow(), 'HHmm')), 0930),1,2)
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

2 REPLIES 2
abm
Super User
Super User

Hi @Alienvolm 

 

Try the below

 

if(less(int(formatDateTime(utcNow(), 'HHmm')), 0930),1,2)
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Thanks! 

 

I used the conversion function from UTC, but your solution worked as well! Thanks a lot! 🙂

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (3,588)