Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

How to get all Mondays day between two dates?

Posted on by

Hi Folks,

 

I'm trying to create a collection which has all Mondays date in the current financial year. (April 1 2023, to March 31 2024). I found the below code which returns all Mondays in a calendar year:

 

ClearCollect(weeksList,
 ForAll(Sequence(52,-26,1) As DD,
 Text(DateAdd(DateAdd(Today(),-Weekday(Today(),Monday)+1),7 * DD.Value ,Days),DateTimeFormat.ShortDate)
 )
);

 

Can some one help me to modify this code such that it will return all Mondays between two dates?

 

Thanks

Categories:
  • Verified answer
    Re: How to get all Mondays day between two dates?

    Hi @rbn_nue ,

     

    Please try:

    Filter(
    With(
     {
     StartDate:DateValue("April 1 2023"),
     EndDate:DateValue("March 31 2024")
     },
     ForAll(
     Sequence(DateDiff(StartDate,EndDate),1,1),
     If(
     Weekday(DateAdd(StartDate,Value,TimeUnit.Days))=2,
     {Value:DateAdd(StartDate,Value,TimeUnit.Days)}
     )
     )
    ),!IsBlank(Value))

     

    Best Regards,

    Bof

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,246

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,884

Leaderboard