Time Difference Calculator (HH:MM:SS)

Subtract one time from another and read the result as HH:MM:SS plus total seconds, minutes, and decimal hours. Handles cross-midnight spans automatically.

Inputs

Accepts HH:MM, HH:MM:SS, or 12-hour forms with am/pm (e.g. 9:00 am).

Same formats accepted as start time.

Cross-midnight is the right behaviour for night-shift / overnight durations.

Result

Duration
08:30:00
  • Total seconds30,600
  • Total minutes510.0000
  • Decimal hours8.5000
  • Plain English8h 30m 0s
Note โ€” Same-day clock arithmetic only โ€” no DST/timezone correction. For schedules that cross a DST boundary use a date-aware calculator.

Step-by-step

  1. Parse start โ†’ 32400 seconds-of-day; end โ†’ 63000 seconds-of-day.
  2. Compute end โˆ’ start = 30600 seconds.
  3. Convert seconds back: hh = floor(diff/3600), mm = floor((diff%3600)/60), ss = diff%60.

How to use this calculator

  • Enter the start and end time in either 24-hour or 12-hour format.
  • Pick the cross-midnight behaviour you want โ€” Cross-midnight is the right choice for overnight shifts and travel times.
  • Read the HH:MM:SS headline or any of the equivalent total-time rows underneath.

About this calculator

Subtract one wall-clock time from another and you get a duration โ€” but the moment the end time wraps past midnight, naรฏve subtraction gives you a negative number that does not mean anything physical. This calculator handles the wrap explicitly: pick the behaviour you want (span crosses midnight, auto-swap to always positive, or strictly report the negative) and read the result both as a HH:MM:SS string and as cumulative seconds, minutes, and decimal hours. Inputs accept 24-hour (09:30, 17:15:00) or 12-hour with am/pm (9:30 am, 5:15 pm). Useful for time-card math, race-split arithmetic, and night-shift duration.

How it works โ€” the formula

diff = end_seconds โˆ’ start_seconds if diff < 0 and mode = cross-midnight: diff += 86400 HH:MM:SS = (โŒŠdiff/3600โŒ‹, โŒŠ(diff%3600)/60โŒ‹, diff%60)

Wall-clock time is a 24-hour cyclic group; subtracting modulo 86400 is the standard handling for spans that cross midnight. Below midnight, integer-second arithmetic avoids the FP precision quirks that show up in spreadsheet time math.

Worked examples

Example 1
Standard day shift
Inputs:
09:00 โ†’ 17:30
Output:
08:30:00 (8.5 h)
Example 2
Overnight shift
Inputs:
22:00 โ†’ 06:00 (cross-midnight)
Output:
08:00:00 (8 h)
Example 3
12-hour input
Inputs:
9:30 am โ†’ 1:15 pm
Output:
03:45:00

Limitations

  • No DST / timezone correction โ€” pure clock arithmetic on a single calendar day.
  • Same-day spans only (or a single midnight crossing). For multi-day durations use a date-time calculator.
  • Bare integers are interpreted as hours; for minute-only inputs include the colon (e.g. "0:45").

Integer-second arithmetic โ€” results are exact for any valid input.

Frequently asked

If your end time is numerically smaller than your start time (e.g. 22:00 โ†’ 06:00) the calculator interprets it as "the next morning" and adds 24 hours to the difference. So 22:00 โ†’ 06:00 returns 8h 0m 0s, not โˆ’16h.

Related calculators

More tools you might like