Work out duration excluding weekends

0
Hi, I am creating a holiday request application and i would like the employees to input a start date and end date then the microflow calculate the duration in days excluding weekends. Does anybody have any idea on how to do this? Thanks
asked
3 answers
4

Heey Ben,

A while back i uploaded a module to the appstore that can do this for you.

Take a look at https://appstore.home.mendix.com/link/app/110117/

Kind regards,

Edo

answered
3

You could also do it by logic thinking.

Step 1, calculate the amount of full weeks you have in the period, and multiply this with 5.
 –   (daysBetween($StartDate,$EndDate) – (daysBetween($StartDate,$EndDate) mod 7) div 7)*5

Step 2, find out which days are in your remainder (because you could have not full weeks)
 – Create a variable with the number of remainder days: daysBetween($StartDate,$EndDate) mod 7. 

 – The rest could be done in the microflow like this.

EDIT: Damn, forgot to plus the counter. So before “change Variable” also add 1 to the counter variable.

Step 3: Now just add those two numbers, and you have the amount of non-weekend days. (Ofcourse now you have holidays included, but the question said excluding weekends :) )

answered
-1

The following worked for me:

floor(daysBetween(Start,End) - floor(daysBetween(Start,ENd) div 7) - floor(daysBetween(Start,End) div 8))

answered