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 / Custom working days an...
Power Apps
Answered

Custom working days and hours

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hey all,

 

Can you please give me an advice about this:

 

In this POST @Sienna managed to find me an amazing way how to add hours to a date or even days, while skipping Friday and Saturday, and 15:30 till 07:59.

 

Now what I kindly want, and hopefully can someone figure it:

 

  • How can I make custom working hours, like if the working hours changed from 08:00 - 15:30 to 09:30 - 14:30.
  • How can I add Holidays that I input to be skipped from the calculations done by Sienna in the post I linked.

 

For example. To have TextInput1 and TextInput2, TextInput1=start of working hours (09:30), TextInput2=end of working hours (14:30)

And another example for holidays. Put holidays on OneDrive and put it as a source in PowerApps and to read that these days the formula has to bypass them as if they were Friday and Saturday which are weekends.

 

Thanks again.

It would be appreciated if someone could help me with this.

Categories:
  • Verified answer
    v-micsh-msft Profile Picture
    Microsoft Employee on at

     

    For deal with hoilday, please check:

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

     

    Basically the logic here is to count the number of the hoildays, then remove the number from the DateDiff() calculation.

     

    For example, the table to record the holiday is named Holiday2017:

     

    RoundDown(DateDiff(StartDate.SelectedDate, EndDate.SelectedDate, Days) / 7, 0) * 5 +
    Mod(5 + Weekday(EndDate.SelectedDate) - Weekday(StartDate.SelectedDate), 5) -
    CountIf(Holidays2017, Date >= StartDate.SelectedDate, Date <= EndDate.SelectedDate)

    For hour calculation, if here you would like to use Sienna's example, the part you need to change is 480 and 450.

    480 is the start working time, which should be replaced by

     

    60*value(StartHour.text)+value(StartMinute.text)

    450 is the working duration, which should be replaced by:

    DateDiff(Time(StartHour.text,StartMinute.Text),time(EndHour.Text,EndMinute.Text),Minutes)

    Regards,

    Michael

     

     

     

     

  • tianaranjo Profile Picture
    497 on at

    @v-micsh-msft

     

    I'd like to add days from the date an item is created to assign it as a due date.  I want to exclude weekends and holidays when assigning the due date.  I created a datasource with the company holidays.  Currently DueDate is DateAdd(Now(), 2).

     

    Can you tell me how to modify the formula?  This is working as intended --  if I have a start and end date.  However, I want to populate a date based only on one date, Now().

    Thank you! 

     

    RoundDown(DateDiff(StartDate.SelectedDate, EndDate.SelectedDate, Days) / 7, 0) * 5 +
    Mod(5 + Weekday(EndDate.SelectedDate) - Weekday(StartDate.SelectedDate), 5) -
    CountIf(Holidays2017, Date >= StartDate.SelectedDate, Date <= EndDate.SelectedDate)

     

  • tianaranjo Profile Picture
    497 on at

    Looking to throw this out there again - I'd like to AddDays to a date of Now(), taking into consideration weekends and holidays.  Suggestions would be appreciated.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @v-micsh-msft

     

    Thank you appreciate your efforts 🙂

  • rajivmadhav Profile Picture
    4 on at

    Hi @tianaranjo I am also looking for the same. Let me know if you have already found the answer.

  • SimplrMac Profile Picture
    35 on at

    How about calculate time/minutes between 'ranges' of hours?

     

    For example; 8:00/17:59 = DAY, so later I will calculate overtime for normal tariff

    But 17:59/23:59=EVENING,  NIGHT till 7.59 and for weekends another schedule.

     

    The calculation of minutes is done.

    DateDiff(DateTimeValue(CheckOut.Text); DateTimeValue(CheckIn.Text)) * 1440 + Minute( DateTimeValue(CheckOut.Text)) - Minute(DateTimeValue(CheckIn.Text))

     


    But I want to know how many minutes in DAY and how many in EVENING?

    So checkin 17.58 checkout 18.02 must give me

    2 minutes DAY

    2 minutes EVENING

     

    Any ideas?

    Thank you!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard