cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
courfeyrak
Level: Powered On

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
Level: Power Up

Re: Get date and time

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

Community Support Team
Community Support Team

Re: Get date and time

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.
jbaideme
Level: Power Up

Re: Get date and time

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!

TheD
Level: Power Up

Re: Get date and time

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?

jbaideme
Level: Power Up

Re: Get date and time

@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.

Highlighted
june59
Level: Power Up

Re: Get date and time

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
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 272 members 3,355 guests
Please welcome our newest community members: