How Many Hours Between Two Times? (Including Overnight Shifts)
Subtracting two clock times is easy until the shift crosses midnight and the answer comes out negative. Here's the 24-hour fix, a worked example, and a free calculator that does it for you.
Working out the hours between 9:00am and 5:00pm takes about two seconds. Working out the hours between 10:30pm and 6:15am takes most people three attempts and a piece of paper — and it's the second one that shows up on real timesheets. ## Why overnight spans break the maths Clock times are cyclical, not linear. When you write 6:15 as a number it looks smaller than 22:30, so plain subtraction gives you a negative result: 6:15 − 22:30 = −16:15
That's obviously wrong, but it's exactly what a spreadsheet will hand you if you subtract two time cells without accounting for the day boundary. ## The fix: add 24 hours first If the end time is earlier than the start time, the shift crossed midnight. Add 24 hours to the end time before subtracting: 6:15 + 24:00 = 30:15 30:15 − 22:30 = 7:45
So 10:30pm to 6:15am is 7 hours 45 minutes. That single adjustment is the whole trick, and it's what the calculator applies automatically when it detects an end time that falls before the start time. ## A worked example, minute by minute Breaking the same shift into pieces is a good sanity check: | Segment | Duration | |---|---| | 10:30pm → midnight | 1h 30m | | midnight → 6:00am | 6h 00m | | 6:00am → 6:15am | 0h 15m | | Total | 7h 45m | Same answer, arrived at without any 24-hour arithmetic — useful if you want to check a result you don't quite trust. ## The other thing that trips people up: minutes aren't decimals Once you have 7h 45m, a payroll system will often want it as a decimal. 45 minutes is 0.75 hours, not 0.45 — minutes are out of 60, not 100. So 7h 45m is 7.75 hours. If you need that conversion regularly, the decimal hours converter does it in one step, and there's a full guide to decimal hours if you want the reasoning. ## Don't forget the unpaid break A shift duration isn't necessarily paid hours. If your break is unpaid, subtract it: - Shift span: 7h 45m - Unpaid break: 30m - Paid time: 7h 15m If you're totalling a whole week of shifts with breaks, the hours calculator handles multiple rows and gives you gross, break and net totals together. ## When this matters - Checking your payslip. Working out your own shift totals independently is the only way to spot a payroll error. - Night shifts in healthcare, hospitality and security. These roles cross midnight as the norm, not the exception. - Invoicing as a contractor. An hour miscounted on every invoice adds up over a year. - Split shifts. Two separate spans in one day, each calculated and then added. ## Frequently asked questions Why does my spreadsheet give a negative number for a night shift? Because the end time is numerically smaller than the start time and the formula has no idea a day boundary was crossed. Adding 24 hours to the end time before subtracting fixes it — or use a calculator that detects the overnight case for you. Does a night shift count as hours on the first day or the second? That depends on your employer's policy, not on the maths — some attribute the whole shift to the start date, others split it at midnight. The total duration is the same either way. Does this account for daylight saving changes? A duration calculator measures clock-to-clock time, so on the two days a year the clocks change, an overnight shift is actually an hour longer or shorter than the clock suggests. Most employers have a specific policy for those two shifts. How do I convert the result to decimal for payroll? Divide the minutes by 60: 45 minutes ÷ 60 = 0.75, so 7h 45m is 7.75. The decimal hours converter does it instantly. --- Try it at ClockAura's Time Duration Calculator — free, no sign-up, with overnight shifts detected automatically.