cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
espan88
Frequent Visitor

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
Frequent Visitor
3 REPLIES 3
Paulie78
Super User III
Super User III

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
Frequent Visitor

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
Frequent Visitor

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Users online (2,701)