cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

ROUND Current Time down to nearest hour

Hello,

I have a Flow running every three hours which queries a REST endpoint for data then writes that data to an On-prem database. The Flow appears to take anywhere from 1-3 seconds to "fire". I'm worried that records might be missed if they are created during this 1-3 second window. 

 

Example Flow:

Trigger: Recurrance, every 3 hours, initiated at 2019-08-13T09:00:00Z

Action1: Get Current Time

Action2: Subtract Time, Current Time minus 3 hours

Action3: HTTP query to REST API, uses Action1 & Action2 outputs to query time range

 

Example Get Current Times for each run:

  • 2019-08-13T08:00:01.6592223Z.
  • 2019-08-13T11:00:01.0480805Z.
  • 2019-08-13T14:00:02.5570142Z.
  • 2019-08-13T05:00:00.8564303Z.
  • 2019-08-13T02:00:01.5099177Z.

How do I ROUND down the Get Current Time action to the nearest hour to protect against this?

 

Thank yoU!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: ROUND Current Time down to nearest hour

Wow. This was actually VERY easy!!

I used the `startOfHour` function. Solution ended up looking like this:

Action1: Get Current Time

Action2: `startofhour('Get_Current_Time')`

Action3: Subtract Time, Action2 minus 3 hours

Action4: HTTP query to REST API, uses Action1 & Action2 outputs to query time range

 

Hope this helps others!

View solution in original post

1 REPLY 1
Super User
Super User

Re: ROUND Current Time down to nearest hour

Wow. This was actually VERY easy!!

I used the `startOfHour` function. Solution ended up looking like this:

Action1: Get Current Time

Action2: `startofhour('Get_Current_Time')`

Action3: Subtract Time, Action2 minus 3 hours

Action4: HTTP query to REST API, uses Action1 & Action2 outputs to query time range

 

Hope this helps others!

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

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 Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,949)