Date range extract hours that overlap a certain time of the day

I’m having problems figuring out how to extract only the part of a date range that overlaps a certain time interval of the day. I,m trying to use this to automate salary calculation for users, problem is that in my country we have quite complex salary calculations with “if this - than that” up to the wazoo. A couple of examples:

Night pay: For hours between 21:00-06:00 every day gives added pay of x-amount pr hour.
Weekend pay: For hours between saturday 18:00 - monday 06:00 gives added pay of x-amount
If holiday: Added pay of 100% for every hour in between a set date time range.
Seniority: If employee has 0-1year = this hourly rate / 1-2years= this hourly rate 2-4years=this rate 4-6=this rate and so on up til 10years.
If employee has a certificate of apprenticeship: then all these hourly rates are another again.

And to make it better the rates and the added pay hours are different for all occupations of course. So im trying to use a couple of these sets of salary rules for a couple of occupations, and it all gets very complex extracting the information from a single date range specified in a shift calendar event. The idea is to take the shift calendar events date range and extract how many hours fall between hours where night pay should be added and how many fall between hours where weekend pay should be added and so on.

If anyone knows how to do this and can get it done without to much cost then i would rather outsource this part then using even more time on doing it myself. Looking forward to any replies and can elaborate if extra information is needed.

1 Like

Hi! What does “without too much cost” mean for you?

1 Like

Hi! Good question, I haven’t set an amount for that but I guess it would depend on what I’m buying, if it’s only for help with an expression to get the desired result from the date range maybe 100-200USD, if I’m getting a complete solution for use in all salary calculations it would depend on the estimated use of hours but understand that one has to make money so a rate in between 80-110usd/h depending on experience an speed

The output should be a calculated payment depending on the hours of the shift?

and plus years of exp?

Yes, output should be a calculated payment where all variables would have been taken into consideration. extra for holidays, night hours, weekends, seniority, etc

Check your DM, please.