cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Highlighted
New Member

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

Highlighted
Community Support
Community Support

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.
Highlighted
New Member

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!

Highlighted
New Member

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?

Highlighted
New Member

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
New Member

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
Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Top Solution Authors
Top Kudoed Authors
Users online (5,702)