Scarlett
I haven't tried this myself and it is a suggestion only! You might hav
to give it a try!
In my earlier post, I have indicated how you can extract the hou
component from both the start and finish times. Once you have don
that, you will need to check if *BOTH* of these are before 6 pm O
*BOTH* of these are after 6 pm.
If this is the case then apply the day or the night rate as applicabl
(you can check which one applies by checking if the hour component o
either one of them is before or after 6pmm) for all the hours worked.
If not, then you know that both of these rates apply. You will need t
determine the hours to which the day and the night rates apply. You d
this (in your example where your driver works between 5am and 8pm) b
substracting the hour component of 5am from the hour component of 6p
and applying the day rate to these many number of hours. You then appl
the night rates to the number of hours arrived at by substracting th
hour component of 6pm from the hour component of the finish time
Finally take the sum of the two.
Yes, this would be a case of nested if's.
My recommendation is that you first give it a go on your own. If yo
have persistent problems, feel free to seek further assistance.
I will be more than happy to help!
At this particular point in time, I am in a bit of hole myself but tha
wouldn't stop me from helping you out!
Best regards
Deepak Agarwa