cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jkniffen
Helper II
Helper II

Change Date Picker Default Date

Hi,

 

Is there a way to change the Date Picker Default Date?  What I would like to show as the default date is the current date plus 5 business days.  Is this possible?

 

Thank you for your help.

 

Joe

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

@jkniffen 

Here's a formula that will calculate todays date + 5 business days.

With({ startDate:Today(),
       daysToAdd: 5
      },
      DateAdd(startDate, daysToAdd) + 
      RoundDown(daysToAdd/5, 0)*2 +
      Switch(Weekday(startDate, StartOfWeek.Monday),
             5,If(Mod(daysToAdd, 5)>0,2,0),
             4,If(Mod(daysToAdd, 5)>1,2,0),
             3,If(Mod(daysToAdd, 5)>2,2,0),
             2,If(Mod(daysToAdd, 5)>3,2,0),
             1,If(Mod(daysToAdd, 5)>4,2,0)
      )
)

I have a post that describes how this formula works.

http://powerappsguide.com/blog/post/formulas-how-to-cope-with-weekends-public-holidays-in-date-calcu...

 

Also, you might consider voting for my idea here to include a built-in function to calculate business days.

View solution in original post

9 REPLIES 9
gabibalaban
Dual Super User
Dual Super User

@jkniffen ,

Set the default date property of the control to:

DateAdd(Today(),5,Days)

hope it helps !

eka24
Super User
Super User

DefaultDate:

Today() + 5

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

Thank you very much for your help.   🙂  Your formula works great but I need to only count business days and not weekends.  Is that possible?

Thank you very much for your help.   🙂  Your formula works great but I need to only count business days and not weekends.  Is that possible?

eka24
Super User
Super User

Check this tutorial from Reza Dorani:

https://youtu.be/QVvhDe6puq0?t=31

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

eka24
Super User
Super User

Check this tutorial from Reza Dorani:

https://youtu.be/QVvhDe6puq0?t=31

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

timl
Super User
Super User

@jkniffen 

Here's a formula that will calculate todays date + 5 business days.

With({ startDate:Today(),
       daysToAdd: 5
      },
      DateAdd(startDate, daysToAdd) + 
      RoundDown(daysToAdd/5, 0)*2 +
      Switch(Weekday(startDate, StartOfWeek.Monday),
             5,If(Mod(daysToAdd, 5)>0,2,0),
             4,If(Mod(daysToAdd, 5)>1,2,0),
             3,If(Mod(daysToAdd, 5)>2,2,0),
             2,If(Mod(daysToAdd, 5)>3,2,0),
             1,If(Mod(daysToAdd, 5)>4,2,0)
      )
)

I have a post that describes how this formula works.

http://powerappsguide.com/blog/post/formulas-how-to-cope-with-weekends-public-holidays-in-date-calcu...

 

Also, you might consider voting for my idea here to include a built-in function to calculate business days.

Thank you very much for your help.   🙂

Thank you so much for your help.  Impressive code and works awesome!  Thank you again!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,787)