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

How to Disable Sunday Datepicker

Hi Powerheros,

 

 

I want to disable selecting of sunday in date picker please suggest me how to achieve it 

 

If(Weekday(DatePicker1.SelectedDate, StartOfWeek.Sunday) <> 5, "You have selected sunday, Change the selection") 
 
1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Thorpe
Super User
Super User

The only thing I see wrong with the formula is that if the start of your week is Sunday then you should be comparing it to 1.

 

If(Weekday(DatePicker1.SelectedDate, StartOfWeek.Sunday) = 1, "Sunday", "Not Sunday ") 

You can put the code into a label as a warning and/or gray out the submit button to prevent the user from submitting until they have correct the issue.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

2 REPLIES 2
Jeff_Thorpe
Super User
Super User

The only thing I see wrong with the formula is that if the start of your week is Sunday then you should be comparing it to 1.

 

If(Weekday(DatePicker1.SelectedDate, StartOfWeek.Sunday) = 1, "Sunday", "Not Sunday ") 

You can put the code into a label as a warning and/or gray out the submit button to prevent the user from submitting until they have correct the issue.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

hi @Jeff_Thorpe  what if I would like to enable only saturday and sunday date picker and disable weekdays?

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,857)