cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
courfeyrak
Regular Visitor

Get date and time

Hello, I have created a flow, and it fires every hour, and performes some steps and then send an email.  

 

Is there a way that i can get the time of the day? so I can disable the workflow outside of labor hours?, 

 

Thanks!

6 REPLIES 6
DewBerry
New Member

How about using @utcnow() on a Data - Compose step and build a condition inside a loop around it to get the time which is in this format: 2017-04-04T14:44:44Z

v-micsh-msft
Community Support
Community Support

Hi @courfeyrak,

 

Could you please share more details about your current flow?

If you just want the flow to run outside the labor hours, then we may consider take use of the recurreccy:

Run flows on a Schedule

The recurrency would allow to specify the Start time:

38.PNG

You could specify the start time outside the labor hours, and then configure the frequency.

 

Besides, if you already added the Recurrency, then we could add a condition to check the current time (UtcNow()), if it is within the labor hours, do nothing, otherwise, run the flow action.

For example, the working hours is between 8:00 and 18:00, we could write the following formula under Condition Advanced mode to verify:

@and(
    GreaterOrequals(
                   formatdatetime(utcnow(),'HH:ss'), 
                   formatdatetime('8:00','HH:ss')
          ),
     lessOrEquals(
                   formatdatetime(utcnow(),'HH:ss'),
                   formatdatetime('18:00','HH:ss')
          )
 )

See screenshots:

39.PNG

 

If the current time is within the labor hour range (greater than 8:00 and less than 18:00 in the example), under the IF YES part, specify nothing, under the IF NO part, add your following flow Actions.

 

Note: UTCNow() function returns the time in UTC time zone, make sure to specify the corrseponding working hour with the proper time.

 

If you need any further assistance on this topic, please post back.

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Slightly different, but same principle I think. I would like a FLOW to run once a day that checks a folder in sharepoint. If the contained files are more than 2 weeks old, delete them.

I'm starting with "SharePoint - List Folder"

then, adding  an Apply to Each =  "Body"

then, Conditional = if Object Name  "Last Modified" is less than... "my guess is to input -14", but I'm not sure and I don't want to delete any more files than necessary.

Any help?

Thanks!

I want to create a similar flow like jbaideme, but I want to delete files on onedrive which are older then 12 month. Has anybody an idea how to do this?

@TheD, I ended up just changing the retension policy for the document library. That is a more straightforward aproach I overlooked at first. Since the files I'm dealing with are not modified and I'm not concerned with that, I just set it for 14 days and it get's rid of every file that's older than (was created past) 14 days. I don't know off hand if OneDrive has a similar retension policy you can set, but you may want to explore that.

Anonymous
Not applicable

Can I identify date rather than time on it? 

@and(
GreaterOrequals(
FORMATDATETIME(utcnow(), 'yyyy-MM-dd'),
FORMATDATETIME( '07/29/2018', 'yyyy-MM-dd')
),
lessOrEquals(
FORMATDATETIME(utcnow(), 'yyyy-MM-dd'),
FORMATDATETIME(''07/30/2018' , 'yyyy-MM-dd')

I tried to use this, but it can no work....

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,022)