How it is worked out
duration = end time − start time (+ 24 h if it crosses midnight)
Why it is done this way
Subtracting two clock times gives a negative number as soon as the end is smaller than the start, which is what happens with anything finishing in the small hours. The fix is to add twenty-four hours to that subtraction, which is the same as understanding that the end belongs to the next day.
Step by step
- Turn both times into minutes since midnight: 20:30 is 1,230 minutes
- Subtract the start from the end: 135 − 1,230 = −1,095
- If it comes out negative, add 1,440 minutes, which is a whole day: 345
- Divide by 60 to get back to hours and minutes: 5:45
What is worth knowing
Working out a night shift also means deciding what to do with the breaks, which is why they have their own field: the gross duration is how long the event runs and the net one is what actually gets paid or worked. If the event runs longer than twenty-four hours, two clock readings are not enough to describe it and you need the dates: the days between dates calculator does that.