Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 9mAASgQaPOn/Gi3TddV8uP
Power Automate - Building Flows
Answered

Take current date and display date of forthcoming Monday

Like (0) ShareShare
ReportReport
Posted on 21 Dec 2018 11:10:30 by

Hi,

 

The function below takes the current date and calculates the date 3 days after;

 

formatDateTime(addDays(utcNow(),3),'yyyy-MM-dd')
 
However, I would like the function to display the date of the next forthcoming Monday without having to state how many days this is offset from. Furthermore, if the current date falls on a Monday, I would like the calculated date to not be the current date, but rather the following Monday. Hope that makse sense!
 
Any help appreciated.
Thanks
  • ChuckQ Profile Picture
    Microsoft Employee on 28 May 2024 at 16:12:31
    Re: Take current date and display date of forthcoming Monday

    In case someone comes here in the future and wants something a little more streamlined, consider the following expression. Assume Monday is Day 1, Tuesday 2, etc. for targetDay. This will output the number of days until the next targetDay:

     

    if(equals(mod(add(sub(targetDay, dayOfWeek(utcNow())), 7), 7), 0), 7, mod(add(sub(targetDay, dayOfWeek(utcNow())), 7), 7))

     

    This will output the date of the next targetDay:

    addDays(utcNow(), if(equals(mod(add(sub(targetDay, dayOfWeek(utcNow())), 7), 7), 0), 7, mod(add(sub(targetDay, dayOfWeek(utcNow())), 7), 7)))

    Depending on what you're using this for, it may be worth converting the output to local time (i.e. for inclusion in an email).

  • Nareshtv Profile Picture
    2 on 24 May 2022 at 18:28:53
    Re: Take current date and display date of forthcoming Monday

    I'm looking to get next tuesday, can you help me with what will be the change in function. 

  • takolota1 Profile Picture
    4,859 Super User 2025 Season 1 on 18 Feb 2022 at 06:04:25
    Re: Take current date and display date of forthcoming Monday

    Also if anyone needs to get the date of the next monday, tuesday, friday, saturday... etc. Then you can use this example flow to continually get the date of any upcoming day of the week

    https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Get-Next-Date-s/td-p/2581331

     

    @Nareshtv 

  • Marty3012 Profile Picture
    on 24 Dec 2018 at 09:09:22
    Re: Take current date and display date of forthcoming Monday

    That works! Thanks very much for your help.

  • Verified answer
    v-yuazh-msft Profile Picture
    on 24 Dec 2018 at 05:06:18
    Re: Take current date and display date of forthcoming Monday

    Hi @Marty3012

     

    Please refer to screenshot below to get the date of the following Monday:

    Capture.PNG

     

    The expression in the Compose as below:

    if(equals(dayOfWeek(utcNow()),1),addDays(utcNow(),7),if(equals(dayOfWeek(utcNow()),2),addDays(utcNow(),6),if(equals(dayOfWeek(utcNow()),3),addDays(utcNow(),5),if(equals(dayOfWeek(utcNow()),4),addDays(utcNow(),4),if(equals(dayOfWeek(utcNow()),5),addDays(utcNow(),3),if(equals(dayOfWeek(utcNow()),6),addDays(utcNow(),2),if(equals(dayOfWeek(utcNow()),0),addDays(utcNow(),1),null)))))))

    The expression in the Compose 2 as below:

    formatDateTime(outputs('Compose'),'yyyy-MM-dd')

    The flow would run successfully as below:

    Capture.PNG

     

    Please let me know if your problem could be solved.

     

     

    Best regards,

    Alice

  • AlanPs1 Profile Picture
    2,471 on 21 Dec 2018 at 12:27:38
    Re: Take current date and display date of forthcoming Monday

    I am just having a look and trying to create using preset variables and some conditions. Basically test all the day of week logic an advance of populating the email, then populate the email with the following Monday in that way. you may want to look at dayOfWeek() in line with your expression. I'll update later once I get somewhere.

  • Marty3012 Profile Picture
    on 21 Dec 2018 at 11:58:08
    Re: Take current date and display date of forthcoming Monday

    Current flow is shown below. What I'm trying to do is add the date for the forthcoming Monday in the Body of the Send Email section. The FormatDateTime() function in the body of the email is what I have at the moment.

    Thanks

     

    Flow - Ex.png

  • AlanPs1 Profile Picture
    2,471 on 21 Dec 2018 at 11:45:19
    Re: Take current date and display date of forthcoming Monday

    Hi @Marty3012

    I'm having a think at ways you can achieve this but think it would be helpful if you could post pictures of your flow with any detail possible. Could you do that?

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 79

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 70 Super User 2025 Season 1

#3
David_MA Profile Picture

David_MA 48 Super User 2025 Season 1

Overall leaderboard