cancel
Showing results for
Did you mean:
Helper II

## Take current date and display date of forthcoming Monday

Hi,

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

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
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support

Hi @Marty3012

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

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:

Best regards,

Alice

7 REPLIES 7
Resident Rockstar

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?

Proud to be a Flownaut!

Helper II

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

Resident Rockstar

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.

Proud to be a Flownaut!

Community Support

Hi @Marty3012

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

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:

Best regards,

Alice

Helper II

That works! Thanks very much for your help.

Memorable Member

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/Date-of-Next-Chosen-Day-of-Week/td-p/146...

New Member

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

Announcements

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

#### A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

#### Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.