web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to Perform a task ...
Power Automate
Answered

How to Perform a task at a specific time.

(0) ShareShare
ReportReport
Posted on by 37

I want to stop a running flow at 23:55:00. I was hoping to find a quick and easy way to do it.
All I could do is this. 
Is there an easier way to achieve the same result? Here I must compute the number of minutes since midnight to perform the time diff calculation.

 

DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateOnly CurrentDateTime=> Midnight
DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateAndTime CurrentDateTime=> TimeNow
DateTime.Subtract FromDate: TimeNow SubstractDate: Midnight TimeUnit: DateTime.DifferenceTimeUnit.Minutes TimeDifference=> TimeDifference
IF TimeDifference >= 1435 THEN
 EXIT Code: 0
END

 

 

I have the same question (0)
  • lbendlin Profile Picture
    8,726 Super User 2026 Season 1 on at

    How exact does it have to be?  Your flow needs to go through your code at least once every 2.5 minutes, otherwise you risk missing the cut.  But if you need it more precise then that piece of code would need to run much more frequently.

  • philippecand Profile Picture
    37 on at

    This does not have to be precise. the flow is a loop running during the day, I want it to stop around midnight to leave room for other nightly flows running from 12:15 to 6AM.
    I have this check at the beginning of each loop cycle, if the iteration starts on or after 11:55 the flow stops.
    It can be about 1-2 minute later than 11:45, no problem as long as it stops before midnight.
    I start the flow with a bat file in Shell:Startup or with a scheduler like Splinterware scheduler, the flow runs in an almost endless loop, when the time is close to midnight the flow must stop for the night.

  • Verified answer
    Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    You could do it in less steps by checking the parameters of the current time. See this sample, for example:

    DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateAndTime CurrentDateTime=> CurrentDateTime
    IF ((CurrentDateTime.Hour > 23 AND CurrentDateTime.Minute > 55) OR CurrentDateTime.Hour = 0) = True THEN
     EXIT Code: 0
    END
    

     

    It will stop if it's after 23:00 or between 00:00 and 01:00.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 252 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 169

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard