Every other time calculation assumes the end is bigger than the start. Midnight breaks that assumption. The clock reaches 24:00, resets to 00:00, and starts climbing again, so an interval that begins at 22:00 and ends at 06:00 has an end time that looks eight hours earlier than its start. Subtract in the usual way and you get a negative answer, which is the clock's way of telling you the interval wrapped around the day boundary.
Millions of people live inside that wrap: night-shift nurses, security guards, bakers, truck drivers, parents of newborns, and anyone who has taken a red-eye flight. For all of them, calculating time across midnight is not an edge case - it is the main case. The two methods below handle it cleanly, and the time calculator on our homepage applies the same logic automatically when you give it a start and an end.
Method 1: split the interval at midnight
The most intuitive fix is to cut the interval into two ordinary pieces at midnight and add the pieces. Piece one runs from the start time to midnight. Piece two runs from midnight to the end time. Neither piece crosses anything, so both are simple same-day sums.
Take the classic night shift, 10 PM to 6 AM. From 10 PM to midnight is 2 hours. From midnight to 6 AM is 6 hours. Total: 8 hours. Now a less round example: a security guard clocks in at 11:25 PM and out at 1:10 AM. From 11:25 PM to midnight is 35 minutes. From midnight to 1:10 AM is 1 hour 10 minutes. Add them: 35 + 70 = 105 minutes, which is 1 hour 45 minutes. The split method is easy to do in your head because midnight is the roundest number on the clock - everything measures cleanly to it and from it.
Method 2: add 24 hours to the end time
For paper, spreadsheets and anything you will repeat, the add-24 method is tidier. Pretend the end time belongs to a clock that keeps counting past 24: add 24 hours to it, then subtract the start as usual. The 10 PM to 6 AM shift becomes 30:00 minus 22:00 = 8 hours. The guard's shift becomes 25:10 minus 23:25 - borrow an hour for the minutes, 24:70 minus 23:25 - which gives 1 hour 45 minutes, matching the split method exactly.
In minutes the same trick reads: end minutes plus 1,440, minus start minutes. A flight departing at 9:40 PM (1,300 minutes) and arriving at 5:25 AM (325 minutes) gives 325 + 1,440 - 1,300 = 465 minutes, or 7 hours 45 minutes in the air. Airlines, hospitals and payroll systems all compute overnight spans this way under the hood, because it turns a special case back into an ordinary subtraction. Our guide on the time difference between two times covers the ordinary case in full; this page is its overnight extension.
Breaks, naps and other things inside the interval
An overnight interval often contains pieces that should not count. The rule is simple: calculate the full span across midnight first, then subtract the pieces that do not count, wherever they fell. A hospital shift from 7 PM to 7 AM spans 12 hours. A one-hour meal break at 1 AM and two paid 15-minute rests inside it: the meal break comes off, the paid rests do not, and the paid time is 11 hours. The break itself crossed nothing - 1 AM to 2 AM is an ordinary hour - so it needs no special handling.
The same logic serves parents timing a baby's sleep, arguably the most midnight-crossing calculation in ordinary life. Down at 8:40 PM, awake at 5:15 AM: split at midnight gives 3 hours 20 plus 5 hours 15, a total of 8 hours 35 minutes of sleep, minus whatever the 2 AM feed took out of the middle. And for travellers, jet lag planning is just this arithmetic done in advance: land at 6 AM local after a 7 hour 45 minute flight and you know exactly how much of your body clock's night the flight consumed.
Recording overnight work correctly
Two record-keeping habits prevent most overnight disputes. First, log the shift against the date it started. A shift beginning at 11 PM on Friday belongs to Friday's row on the time card, even though seven of its eight hours fall on Saturday. Payroll systems, overtime rules and the guides in our guides section all assume this convention, and mixing conventions between weeks is how hours quietly vanish.
Second, write both times with their labels attached - "Fri 11:00 PM to Sat 7:00 AM" - rather than a bare "11 to 7". The bare version forces whoever reads it later to guess which side of midnight each number sits on, and a guessed time card is a wrong time card waiting for a busy week. If your workplace uses the 24-hour clock, the pair "23:00 to 07:00 (+1 day)" carries the same information with no AM or PM to lose. The homepage calculator accepts either style and returns the span, which makes it a good independent check before you sign a card that includes nights.
When the interval spans more than a day
Occasionally an interval crosses midnight twice: a drive with rest stops, a slow ferry, a hospital stay. The method stretches naturally - add 24 hours for each midnight crossed. A trip starting Monday at 9:00 PM and ending Wednesday at 6:30 AM crosses two midnights, so the end time in extended form is 6:30 plus 48 hours: 54:30 minus 21:00 gives 33 hours 30 minutes. At that scale most people switch to counting whole days plus a remainder, which is the same arithmetic in a friendlier outfit: one full day, plus 2 hours to Tuesday midnight... in practice, days plus the two clock sums. The principle never changes: unwrap the clock until the end is bigger than the start, then subtract once.
Frequently asked questions
How many hours is a shift from 10 PM to 6 AM?
8 hours. From 10 PM to midnight is 2 hours, and from midnight to 6 AM is 6 hours, and 2 plus 6 is 8. By the add-24 method: 6 AM is 30:00 in extended time, and 30:00 minus 22:00 is 8 hours.
How do I calculate time across midnight with a break in it?
Work out the full span across midnight first, then subtract the break, wherever the break fell. A shift from 11 PM to 7 AM is 8 hours; a 30-minute break at 3 AM brings the paid time to 7 hours 30 minutes. The break does not need its own midnight treatment unless you are timing the break itself.
What is the elapsed time from 11:25 PM to 1:10 AM?
1 hour 45 minutes. From 11:25 PM to midnight is 35 minutes, and from midnight to 1:10 AM is 1 hour 10 minutes. Added together: 35 minutes plus 70 minutes is 105 minutes, which is 1 hour 45.
Why does my spreadsheet show a negative time for overnight shifts?
Because the end time is smaller than the start time, so the subtraction goes below zero and most spreadsheets refuse to display negative times. Add 1 (a full day) to the end value before subtracting, or use the formula end plus 24 hours minus start, and format the result as a duration.
Does the date matter when calculating across midnight?
For the length of the interval, no - only the two clock times matter. For records, yes: an overnight shift is normally logged against the date it started, so a shift beginning on Friday night belongs to Friday even though most of it happens on Saturday.
Johnson Ramzan builds and maintains every calculator on Time Calculator Tools himself, and he tests each one against worked examples he has done by hand before it is allowed near a reader. His guides follow US Department of Labor guidance on hours worked, overtime and rounding, and he writes them the way he would want a payslip explained to him: plain English, real numbers, and no step skipped. When a reader writes in with a shift pattern the tools handle badly, fixing it goes to the top of his list.
Last updated: October 22, 2026
Related guides
Time Difference Between Two Times
The same-day version of this problem, worked by minutes, borrowing and counting up.
Read the guideHow to Calculate Elapsed Time
The general method for any start-to-finish span, with the timeline approach explained.
Read the guideHow to Subtract Time
Taking hours and minutes away from a clock time, including stepping backwards over midnight.
Read the guideWhat Time Will It Be in X Hours?
Counting forward from now, across noon, midnight and the date line of your own calendar.
Read the guide