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.
Result
- Total seconds30,600
- Total minutes510.0000
- Decimal hours8.5000
- Plain English8h 30m 0s
Step-by-step
- Parse start โ 32400 seconds-of-day; end โ 63000 seconds-of-day.
- Compute end โ start = 30600 seconds.
- 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
- Inputs:
- 09:00 โ 17:30
- Output:
- 08:30:00 (8.5 h)
- Inputs:
- 22:00 โ 06:00 (cross-midnight)
- Output:
- 08:00:00 (8 h)
- 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.