Time Math & Duration · How-To

How to Calculate the Duration Between Two Times

Two clock times and one subtraction — simple, until the format doesn't match or the span runs past midnight. Here is the exact three-step method, worked examples for both cases, and a live calculator.

By Reviewed 7 min read

Key takeaways

  • To find the duration between two clock times, convert both to minutes past midnight, subtract the start from the end, then convert the result back to hours and minutes.
  • If the two times aren't already in the same format, convert whichever one is written in 12-hour AM/PM to 24-hour first — then subtract.
  • A negative or zero result means the span crosses midnight. Add 1440 (24 hours in minutes) to the result, then convert back.
  • For a timesheet or spreadsheet, turn the minutes into decimal hours by dividing by 60 — 15 minutes becomes 0.25 hours.
  • This is a different question from a quick estimate of hours between two times, and different again from measuring elapsed time since a starting moment.

A shift runs from 10:15 PM to 6:30 AM. How long is that, to the minute? Subtract the two clock faces directly — the way you'd subtract 10:15 from 6:30 — and you get a negative number, which is obviously wrong; the shift didn't last minus four hours. Finding the duration between two clock times is genuinely simple once both times sit on the same number line first. The mistakes only creep in when the times are written in different formats, or when the span runs past midnight.

This guide covers the exact method: converting to minutes, subtracting, and converting back, plus the specific fix for an overnight span and how to turn the answer into decimal hours for a timesheet. If you just need the number for one pair of times right now, the time duration calculator does it instantly. If you want to be able to do it by hand — on paper, in a spreadsheet formula, or in your head — read on.

01The three-step method

Every duration calculation between two clock times comes down to the same three moves, no matter what the specific times are:

  • Convert both times to minutes past midnight — hour × 60, plus the minutes.
  • Subtract the start from the end.
  • If the result is negative or zero, add 1440 (the number of minutes in a day) — that's the midnight crossing. Otherwise, convert the minutes back into hours and minutes by dividing by 60.

That's the whole method. Everything below is really just detail on applying those three steps when the inputs get messier: mismatched formats, or a span that runs past midnight.

The formula

Duration in minutes = End (in minutes) − Start (in minutes). If that number is zero or negative, add 1440 before you convert it back to hours and minutes.

02A straightforward example

Start with the simplest case: both times are already written the same way, and the end time is later in the day than the start. Take a workday that runs from 09:15 to 17:45.

Worked example · 09:15 to 17:45

  1. Convert both to minutes: 09:15 is 9 × 60 + 15 = 555 minutes. 17:45 is 17 × 60 + 45 = 1065 minutes.
  2. Subtract: 1065 − 555 = 510 minutes.
  3. Convert back: 510 ÷ 60 = 8 hours, remainder 30 minutes.
    Result: 8h 30m

No format conversion and no midnight crossing — this is the case the method is built around. The two sections below just add one extra step on top of it.

03When the two times are in different formats

Real schedules are rarely this tidy. A roster might list the start time in 12-hour AM/PM and the end time in 24-hour, or a spreadsheet might mix both down a single column. Before you can subtract, both times need to sit on the same 24-hour scale.

Converting 12-hour to 24-hour only touches the hour: 12 AM becomes 00, the hours 1 through 11 AM keep their number, 12 PM stays 12, and 1 through 11 PM each get 12 added. Going the other direction, the full rules and worked examples are in How to Convert 24-Hour Time to 12-Hour Time, or use the 12 to 24 hour converter to do either direction instantly.

Take a shift that starts at 8:15 AM and ends at 17:20. Convert the AM time first: 8:15 AM becomes 08:15, which is 495 minutes. The end time is already 24-hour: 17:20 is 1040 minutes. Subtract: 1040 − 495 = 545 minutes, or 9 hours 5 minutes.

04When the span crosses midnight

The one case that trips up a plain subtraction is a span that runs past midnight — an overnight shift, a flight that lands the next calendar day, a late film. Subtracting the start from the end gives a negative number, and the fix is exactly what step three of the method says: add 1440 minutes.

Worked example · 10:15 PM to 6:30 AM

  1. Convert both to 24-hour minutes: 10:15 PM is 22:15, or 22 × 60 + 15 = 1335 minutes. 6:30 AM is 06:30, or 6 × 60 + 30 = 390 minutes.
  2. Subtract as usual: 390 − 1335 = −945. Negative, so the span crosses midnight.
  3. Add 1440: −945 + 1440 = 495 minutes.
    Result: 8h 15m

Why you add 1440, not 24

1440 is 24 hours expressed in minutes (24 × 60), which is why the fix has to happen before you convert the answer back to hours and minutes. Adding "24" to a minutes figure is wrong by a factor of 60 — an easy mistake if you convert back too early.

If the confusion is really about which one of 12:00 AM or 12:00 PM you're starting from, that's a labelling question, not a duration one — see Is 12:00 AM Midnight or Noon? The Confusion, Settled before you convert.

Add 1440, not 24 — the fix happens in minutes, not hours.

05Turning the result into decimal hours

Once you have the duration in hours and minutes, payroll systems and spreadsheets usually want it as one decimal number instead. The conversion is simple: divide the minutes by 60. The 8h 15m shift above becomes 8 + (15 ÷ 60) = 8.25 decimal hours. For every combination of minutes and the rounding conventions payroll systems actually use, see How to Convert Minutes to Decimal Hours for Payroll.

06Calculate a duration right now

Enter a start and end time below — 12-hour or 24-hour, it doesn't matter which — and the duration updates as you type, including the midnight crossing.

Start → end

8h 15m

495 minutes total · 8.25 decimal hours · crosses midnight

Want multiple shifts, rounding rules, or a printable total?

This box is a teaching demo for one pair of times. For rounding rules, multiple entries, and an exportable total, use the full Time Duration Calculator.

07Mistakes that throw off the calculation

  • Subtracting the clock times directly without converting to minutes first — hour-and-minute subtraction has to borrow across the 60-minute mark, and it's easy to get the borrow wrong by hand.
  • Forgetting to convert a 12-hour time before comparing it with a 24-hour one — 8:15 AM and 08:15 only line up once you've actually checked the AM/PM label.
  • Getting a negative or zero result and not recognizing it as the midnight-crossing signal from step three.
  • Entering the exact same time as both start and end. Two identical clock times shouldn't read as no time at all for shift-length purposes, so this method treats it as a full 24-hour span, using the same add-1440 rule that applies to a negative result.
  • Rounding to decimal hours before adding two shifts together, which compounds rounding error. Add the raw minutes first, then convert the total to decimal once.

08Duration vs. "hours between" vs. "elapsed time"

"Duration between two times" answers one specific question: given a fixed start and a fixed end, exactly how much time separates them, to the minute. A few similar-sounding questions are worth telling apart:

Get the exact duration in one step

Enter a start and end time and read the duration back in hours, minutes, and decimal hours — free, private, no sign-up.

Open the calculator →

09Frequently asked questions

How do I calculate the duration between two times?

Convert both times to minutes past midnight, subtract the start from the end, and convert the result back to hours and minutes. If the result is negative or zero, add 1440 minutes for the midnight crossing.

What if the end time is earlier than the start time?

A negative or zero result means the span crosses midnight. Add 1440 minutes — 24 hours expressed in minutes — to the result before converting it back to hours and minutes.

How do I convert the duration into decimal hours?

Divide the minutes by 60. A duration of 8 hours 15 minutes becomes 8.25 decimal hours, since 15 divided by 60 is 0.25.

What's the difference between duration between two times and hours between two times?

Duration between two times gives the minute-exact span between a fixed start and end. Hours between two times is usually a faster, rounded estimate rather than an exact figure.

What happens if I enter the same start and end time?

The calculation treats identical start and end times as a full 24-hour span rather than zero, using the same add-1440 rule that applies to a negative result.

Does this method work if the two times are in different formats?

Yes. Convert whichever time is in 12-hour AM/PM format to 24-hour first, then subtract as usual.

Fletcher Langley

Fletcher Langley

Time & Scheduling Specialist · 24hourto12hour.com

Operations and workforce-systems specialist with 14+ years inside shift-based industries and payroll platforms. Fletcher builds and reviews every tool on the site, and writes its guides so the method is always shown, not just the answer. Read his full profile →

Sources & standards

  1. Conversion method verified by hand; every worked figure in this guide is cross-checked against the three-step rule described above.
  2. U.S. Department of Labor, Wage and Hour Division — general guidance on recording hours worked for payroll purposes. Exact recordkeeping rules vary by jurisdiction and employer; confirm locally. dol.gov
  3. National Institute of Standards and Technology (NIST), Time and Frequency Division — reference for how the minute and hour are defined as units of duration. nist.gov