cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
espan88
Helper I
Helper I

Date calculation - getting first Friday date in two months from today

Hello,

Any ideas on script which can calculate this date? First Friday date in two months from today, for example:

Input:    08-04-2021    (+2 months) it can be any date

             08-06-2021     (getting first Friday of June)

Output: 04-06-2021 

 

I was planning to use 'Compose' to create some script, but nothing worked as expected.

 

I would appreciate any suggestions.

Thanks!

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
espan88
Helper I
Helper I
3 REPLIES 3
Paulie78
Super User
Super User

Like this:

https://ibb.co/VNNSPf0

 

2021-04-08_18-25-41.png

Expressions used from top to bottom:

 

 

action: todayPlusTwoMonths
addToTime(utcnow(), 2, 'Month')

action: select
from: range(0,7)
Date: addDays(outputs('todayPlusTwoMonths'), item())
DayNum: dayOfWeek(addDays(outputs('todayPlusTwoMonths'), item()))
DayName: formatDateTime(addDays(outputs('todayPlusTwoMonths'), item()), 'ddd')

action: First Friday
first(body('Filter_array'))['Date']

 

 

 

espan88
Helper I
Helper I

Thank You Paulie78,

The script seems to be working, but I probably didn't describe my issue properly 😅

 

Script above gets the first Friday after 2 months from given date. 

e.g. 08-04-2021 (+2months) -> 08-06-2021 (first Fri after this date) -> 11-06-2021

 

I meant first Friday of the month after 2 months from given date:

e.g. 08-04-2021 (+2months) -> 08-06-2021 (first Friday of June) -> 04-06-2021

 

Would that be more complicated?

espan88
Helper I
Helper I

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (1,878)