⏱️ Time Duration Calculator

🔧 Operation

⏱️ Duration

➕ Durations to sum

Add between 2 and 100 rows. Per-row components may be left blank (treated as 0) and may include fractional seconds.

➖ Duration a (minuend)

➖ Duration b (subtrahend)

Result is a − b. Negative outcomes are reported with negative: true and a leading minus sign in the HH:MM:SS field.

🕘 Start time

🕔 End time

📤 Result

{{ primaryOutput }}

📊 Detail

HH:MM:SS
{{ result.hhmmss }}
Hms
{{ result.hms }}
ISO 8601
{{ result.iso8601 }}
Days
{{ result.normalized.days }}
Hours
{{ result.normalized.hours }}
Minutes
{{ result.normalized.minutes }}
Seconds
{{ result.normalized.seconds }}
Total seconds
{{ result.totalSeconds.toLocaleString(undefined, { maximumFractionDigits: 6 }) }}
Total minutes
{{ result.totalMinutes.toLocaleString(undefined, { maximumFractionDigits: 6 }) }}
Total hours
{{ result.totalHours.toLocaleString(undefined, { maximumFractionDigits: 6 }) }}
Total days
{{ result.totalDays.toLocaleString(undefined, { maximumFractionDigits: 6 }) }}
Negative
{{ result.negative ? 'yes' : 'no' }}
⚠️

ℹ️ About Time Duration Calculator

What this tool does

The Time Duration Calculator performs signed-second arithmetic on time durations expressed in any combination of hours, minutes, and seconds. Internally a duration is a single signed totalSeconds number, which means fractional seconds (30.5s), large hour counts (120:00:00), and negative results are all first-class. Six operations:

  • Compute — normalize a single duration to days/hours/minutes/seconds plus HH:MM:SS, 1h 30m 45s, and ISO 8601 PT1H30M45S string variants.
  • Add — sum 2-100 durations. Useful for stacking job-step timings, video clip lengths, or workout sets.
  • Subtract — compute a - b. Negative results are allowed and reflected in the negative: true flag plus signed totals.
  • Multiply — multiply a duration by a finite numeric factor (whole or fractional, positive or negative).
  • Divide — divide a duration by a non-zero numeric divisor. Zero divisors throw a validation error.
  • Between two clock times — compute end − start for two wall-clock times. If crosses midnight is checked and end is at or before start, 24 hours is added to end before subtracting.

Common use cases

  • Audio & video editing — sum the runtimes of multiple clips to plan an export bucket, or compute the gap between two timecodes.
  • Payroll & timesheets — derive an 8-hour shift between clock-in (e.g. 09:00) and clock-out (e.g. 17:30) including overnight shifts via the crosses midnight flag.
  • Athletic timing — break a 02:15:34.5 marathon split into total minutes (135.575) or compute average pace by dividing by the kilometer count.
  • Project estimation — multiply a per-unit duration (e.g. 12 minutes per support ticket) by an expected ticket count, or divide a sprint budget across team members.
  • API consumers — convert any input form (HH:MM:SS, "1h 30m 45s", total seconds) into the canonical ISO 8601 PT… string for downstream serialization.

Worked examples

  • Compute — { hours: 1, minutes: 30, seconds: 45 } → totalSeconds 5445, HH:MM:SS 01:30:45, ISO 8601 PT1H30M45S, totalMinutes 90.75, totalHours 1.5125.
  • Compute (overflow) — { seconds: 90061 } → normalized { days: 1, hours: 1, minutes: 1, seconds: 1 }; HH:MM:SS keeps the "stopwatch" form and reports 25:01:01.
  • Add — [{ hours: 1, minutes: 30 }, { minutes: 45 }] → 02:15:00 (2h 15m).
  • Subtract — { hours: 2 } − { hours: 1, minutes: 30 } → 00:30:00; reverse the operands and the result becomes -01:30:00 with negative: true.
  • Multiply — { minutes: 15 } × 4 → 01:00:00; multiply by 2.5 instead and you get 00:37:30.
  • Divide — { hours: 1 } ÷ 4 → 00:15:00; dividing by 0 throws Divisor must not be zero.
  • Between — start 09:00, end 17:30 → 08:30:00. Set start to 22:00, end to 06:00 with crosses midnight on and you get 08:00:00; leave it off and the result is -16:00:00.

ISO 8601 duration reference

All iso8601 output follows the ISO 8601 duration grammar in PT[H][M][S] form (date components like Y/M/D are not emitted — durations have no calendar context here). For negative durations we prepend a - sign per ISO 8601-2:2019 §5.5.1. Zero durations render as PT0S rather than the empty PT form to keep the output unambiguous.

For background, see the ISO overview of ISO 8601 date and time formats and the W3C XML Schema duration datatype, which also uses the P...T... duration notation.

  • PT1H30M45S — one hour, 30 minutes, 45 seconds.
  • PT25H — 25 hours (no day rollover; calendar-free).
  • -PT30M — negative 30 minutes.
  • PT30.5S — fractional seconds preserved.

Notes & conventions

  • Hours can exceed 24 in the HH:MM:SS field — we never truncate to a day boundary, so a duration of 5 days renders as 120:00:00. Day-aware output is in the normalized.days field.
  • Fractional seconds are preserved through every operation. compute({ seconds: 30.5 }) round-trips byte-for-byte.
  • Negative components are allowed because a duration is just a signed number of seconds. compute({ hours: -1, minutes: 30 }) evaluates to -00:30:00 (a duration of negative 30 minutes), the same as compute({ seconds: -1800 }).
  • Clock times in between() are validated strictly: hour 0-23, minute 0-59, second 0 to less than 60. Calling between with hour 24 throws a validation error.
  • NaN and Infinity are rejected. Any component that isn't a finite number throws before any arithmetic happens.

API Usage Example:

POST /api/tools/time/time-duration
Content-Type: application/json

{
    "operation": "compute",
    "hours": 1,
    "minutes": 30,
    "seconds": 45
}
Ready