The basic case: a same-day span
From 9:00 to 17:30: converting both times to minutes past midnight and subtracting gives 510 minutes, which formats back to 8 hours 30 minutes — or 8.5 hours as a single decimal figure.
The overnight case: crossing midnight
From 22:00 to 6:00, the end time (6:00) is numerically earlier than the start time (22:00). Rather than producing a nonsensical negative duration, the calculation assumes the end time falls on the next day, correctly giving 8 hours 0 minutes for a typical night shift.
A shift with an odd number of minutes
From 9:15 to 17:52: the duration works out to 8 hours 37 minutes, or 8.6167 hours as a decimal — a figure that doesn't round to a clean number of minutes, which is exactly why a decimal representation is useful for further calculations like payroll.
Why the decimal-hours figure matters
8 hours and 37 minutes isn't directly multipliable by an hourly wage rate — the minutes need converting to a fraction of an hour first. The decimal figure (8.6167) does that conversion automatically, ready to multiply directly, as the companion article on decimal hours conversion explores further.