web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to get the date of...
Power Apps
Unanswered

How to get the date of the day based on given date's week?

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I have a date, lets say : 18th March 2021. 

 

Now, I require to get that date's week's Tuesday's date  which should be 16th March 2021 - - How can I achieve that for any given date?

 

Thanks,

Categories:
I have the same question (0)
  • RusselThomas Profile Picture
    4,014 on at

    Hi @dave8 ,

    Weekdays in PowerApps are from 1-7 starting on Sunday.

    If your week starts on Sunday as Day 1, then Tuesdays would be Day 3. 

    You can then see if the selected date is before or after Tuesday and write a formula to get to the Tuesday for that week.  It can get pretty confusing, but here's the logic; 

     

    If your selected date's day of the week is x and it's before a Tuesday, you want to subtract it from 3 to get the Delta between that day and Tuesday.  You can then Add this delta back into your date as Days to get the Tuesday Date.

     

    If your selected date's day of the week is x and it's after a Tuesday, you want to subtract 3 from it to get the Delta between that day and Tuesday.  You can then subtract this delta from your date as Days to get the Tuesday Date.

     

    Try this;

    Add a DatePicker control.

    Add a label and set its Text: property to;

    If(Weekday(DatePicker1.SelectedDate)<=3, 
     Text(DateAdd(DatePicker1.SelectedDate, 3-Weekday(DatePicker1.SelectedDate), Days), LongDate), 
     Text(DateAdd(DatePicker1.SelectedDate, (Weekday(DatePicker1.SelectedDate) - 3)*-1, Days), LongDate))

     The Text function just displays the date nicely in the label, you can get rid of it just to get the date for other logic.

    Hope this helps,

    RT

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard