cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Archer76
Frequent Visitor

Set default date for DatePicker depending on business hours

Hi,

Building my first powerapp here (wish me luck). Something that I want to include is to set the default date on the DatePicker so it defaults to Today() unless:

The user is trying to place an order after 4:30 pm on weekdays then it defaults to next day, also to default to Monday after 11:30am Saturday or all day Sunday.

 

Greatly appreciate your help.

 

 

  

1 ACCEPTED SOLUTION

Accepted Solutions
Dant7484
Resolver II
Resolver II

Hi,

I think this will work for you : 

Switch(
Weekday(Now()),
1, Now() + 1, //Sunday
7, If(
Hour(Now()) > 11,
If(
Minute(Now()) > 30,
Now() + 2
),
Now()
), //Saturday
If(
Hour(Now()) > 16,
If(
Minute(Now()) > 30,
Now() + 1
),
Now()
) //Rest of work days
)

View solution in original post

1 REPLY 1
Dant7484
Resolver II
Resolver II

Hi,

I think this will work for you : 

Switch(
Weekday(Now()),
1, Now() + 1, //Sunday
7, If(
Hour(Now()) > 11,
If(
Minute(Now()) > 30,
Now() + 2
),
Now()
), //Saturday
If(
Hour(Now()) > 16,
If(
Minute(Now()) > 30,
Now() + 1
),
Now()
) //Rest of work days
)

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (4,053)