Time window for operating hours only

@ali_aff,

If I understand your problem correctly it is the reverse version of the counting of workdays only Count Weekdays/Workdays
You mentioned that the machines to not run 24h a day and not 7 days a week.

Let’s assume you work Mo-Fr from 8am till 6pm.

So as first step I would identify the amount of days off (weekends) by checking whether the day-of-week (DoW) of start is before DoW of the end (e.g. Mo-Th).
Then calculate the amount of full week between start and end. Now reduce the days between start and end by the amount of days off (two days off per week times amount of weeks. If the DoW of start is past the DoW of end reduce by another weekend.

Now you need to do the same stuff to the workhours based on the amount of days calculated before.

HTH

1 Like