cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JB0007
Helper V
Helper V

Display only weekdays in DatePicker

Hi Power Apps Community,

 

I want to know if there is a way to exclude all weekends from DatePicker or make Saturday and Sunday appear with a different color in DatePicker.

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
mdevaney
Super User
Super User

@JB0007 

No, this is not possible with the DatePicker control.  Believe me, I was looking for this feature at one point too but it does not exist.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

@JB0007 
Yes, there is a way to find NETWORKDAYS using formulas.  Microsoft had a very nice blog post about it.  You can copy + paste the code from it directly into your own app 🙂


Link to MS Blog:

https://powerapps.microsoft.com/de-de/blog/excluding-weekends-and-holidays-in-date-differences-in-po...

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

7 REPLIES 7
mdevaney
Super User
Super User

@JB0007 

No, this is not possible with the DatePicker control.  Believe me, I was looking for this feature at one point too but it does not exist.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Hi @mdevaney  thanks for your reply. 

 

Can I use a formula instead to only count the workdays? For example a formula like the Networkdays function in Excel?

Pstork1
Dual Super User
Dual Super User

Take a look at the answer for this post.  It explains how to build a custom date picker.  The post was about how to start the datepicker on Monday instead of Sunday.  But you may be able to adapt it to disable the weekends.

https://powerusers.microsoft.com/t5/Building-Power-Apps/Change-calendar-page-starting-day-to-monday/...



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@JB0007 
Yes, there is a way to find NETWORKDAYS using formulas.  Microsoft had a very nice blog post about it.  You can copy + paste the code from it directly into your own app 🙂


Link to MS Blog:

https://powerapps.microsoft.com/de-de/blog/excluding-weekends-and-holidays-in-date-differences-in-po...

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

jayeshpr
New Member

Is it possible to disable few dates in the calendar control? for example for some booking slots already full for the particular date it should be disabled and the user can't select that? if not then what is the best way to achieve this use case?

Hi @jayeshpr ,

 

You can try by creating a collection or database with the dates that are not allowed to be selected and use a formula to verify if the date that the user selected is in the collection or database, and if is true disable the button.

 

So for example if you are using a date picker control and a submit button you can insert the following formula in the submit button's display function:

 

If(Datepicker1.SelectedDate in <name of your database/ collection>, DisplayMode.Disabled, DisplayMode.Edit)

First, I have created a collection on the button control.

sonam1996sahoo_1-1668061110536.png

Then I tried this solution but not worked... It's throwing an error like below: 

sonam1996sahoo_0-1668061066544.png

 

Thanks and Regards
Sonam

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (2,551)