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 / Set Approval timeout t...
Power Automate
Answered

Set Approval timeout to midnight

(0) ShareShare
ReportReport
Posted on by 143

Hello Everyone,

 

I am trying to figure out how to set the timeout for a Start and Wait for Approval process to time out after 7-days at midnight (or 23:59:59 Hrs). I tried P7DT23:59 but that didn't work. Any ideas?

 

Many thanks,

Ray Garza

Categories:
  • Verified answer
    iltoningui Profile Picture
    247 on at

    Hi @Ray_Garza

    The correct format would be P7DT23H59M59S.

    Wich actually means 7 days 23 hours 59 minutes and 59 secs from the moment the actions was called.

    You can't make timeout policy expire at midnight since it starts when the action starts and the policy expresses time span and not relative time.

     

    The best you can do is to set P7D.

    This way the flow will expire 7 days after the action is called.

     

  • Ray_Garza Profile Picture
    143 on at

    Thanks, @iltoningui for the clarification. I suspected as much but I wanted to be sure. I can now give users the exact time the notification will expire.

  • iltoningui Profile Picture
    247 on at

    Hi @Ray_Garza 

    I was testing this scenario and I was able to set the timeout using value from the trigger

    iltoningui_0-1648126869400.png

    the @triggerBody()['text'] contains 'P1D'

     

    Basically as long as you use values from the triggerBody/TriggerOutputs you should be able to set this property.

     

    Let me know if you were able to do it.

  • Ray_Garza Profile Picture
    143 on at

    Oh really. Ok, how does this allow the end time to be midnight if it's still using the same duration notation?

  • iltoningui Profile Picture
    247 on at

    Turns out you can use formulas.

    @concat(
     'P',
     '6D',
     'T',
     sub(23, int(formatDateTime(utcNow(), 'HH'))),
     'H',
     sub(59, int(formatDateTime(utcNow(), 'mm'))),
     'M',
     sub(59, int(formatDateTime(utcNow(), 'ss'))),
     'S'
    )

     this will generate

    if the time is 2022-03-24T20:04:10

    this code will generate P6DT3H55M49S

    Wich represents the time until midnight 6 days from now

     

    Note that the code was prettified for readability it would actually be like this.

    @concat('P', '6D', 'T', sub(23, int(formatDateTime(utcNow(), 'HH'))), 'H', sub(59, int(formatDateTime(utcNow(), 'mm'))), 'M', sub(59, int(formatDateTime(utcNow(), 'ss'))), 'S')

     

    Good luck.

  • NewNW Profile Picture
    204 on at

    @iltoningui  Thank you very much for providing the formula. Can you please tell me how to use "AUS Eastern Standard Time" , currently when I use utcNow() it pickup US time so the WorkFlow won't expire at midnight AUS Eastern Standard Time. 

    Thank you very much. 

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

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 426

#2
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard