Hi community! I'm trying to count the difference between two datetime values. But only the part, which are included in worktime (from 10:00 to 19:00) and workdays (a have a table with days marked as workdays and holidays) Examples a1 = '10aug2018:15:00:00'dt b1 = '10aug2018:18:00:00'dt the result must be 3 hours. Because 10aug2018 is workday and the range [15:00;17:00] is fully in range [10:00;19:00]. a2 = '10aug2018:15:00:00'dt b2 = '10aug2018:20:00:00'dt the result must be 4 hours. Because 10aug2018 is workday and the range [15:00;20:00] is not fully in ragne [10:00;19:00]. In this case we count time from 15 to 19 – it is 4. a3 = '11aug2018:15:00:00'dt b3 = '11aug2018:18:00:00'dt the rusult must be 0. Because 11aug2018 is Saturday, and is it not workday. a4 = '10aug2018:18:30:00'dt b4 = '13aug2018:11:30:00'dt the result must be 2 hours. Because we have: 10aug2018: 30 minutes from 18:30 to 19:00 11aug2018 is holiday: 0 12aug2018 is holiday: 0 13aug2018: 1 hour 30 minutes from 10:00 to 11:30 a5 = '10aug2018:15:00:00'dt b5 = '14aug2018:14:00:00'dt the result must be 17 hours 10aug2018: 4 hours from 15:00 to 19:00 11aug2018 is holiday 12aug2018 is holiday 13aug2018: 9 hours (from 10:00 to 19:00) 14aug2018: 4 hours (from 10:00 to 14:00) I tried to solve this case with INTXN function, but I didn't succeed. Hope for your help.
... View more