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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Date Picker start of w...
Power Apps
Answered

Date Picker start of week and end of week

(0) ShareShare
ReportReport
Posted on by

I currently have an application where an employee can select a date from a date picker. When collecting the data, I need identify the start of the week and end of the week based on the date the employee selected. For example, if they select 12/28/23, I need to collect the previous Monday (12/25/23) and the proceeding Sunday (12/31/23). 

 

Is there a way to dynamically grab those 2 dates based on the selected date in a date picker? 

Categories:
I have the same question (0)
  • Verified answer
    Rajkumar_M Profile Picture
    3,747 Moderator on at

    Hi @CSilva 

     

    In PowerApps, the Weekday function can be used to find the day of the week for a date (1 for Sunday, 2 for Monday, and so on). Create a Label control to display.

     

    // Start of the week (Monday)
    DatePicker1.SelectedDate - Weekday(DatePicker1.SelectedDate, StartOfWeek.Monday) + 1

    // End of the week (Sunday)
    DatePicker1.SelectedDate - Weekday(DatePicker1.SelectedDate, StartOfWeek.Monday) + 7

    (Or)

     

    Use Collection:

     

    ClearCollect(
    WeekStartEnd,
    {
    StartOfWeek: DateAdd(DatePicker1.SelectedDate, 1 - Weekday(DatePicker1.SelectedDate, StartOfWeek.Monday), TimeUnit.Days),
    EndOfWeek: DateAdd(DatePicker1.SelectedDate, 7 - Weekday(DatePicker1.SelectedDate, StartOfWeek.Monday), TimeUnit.Days)
    }
    )

     

     

     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 993

#2
Valantis Profile Picture

Valantis 675

#3
11manish Profile Picture

11manish 545

Last 30 days Overall leaderboard