Time Duration Calculator
Quickly compute precise time differences and perform time arithmetic. This professional time duration calculator lets you: find the exact duration between two date‑times, add or subtract a duration to a specific date‑time, and sum multiple intervals—optimized for accessibility and mobile use.
Interactive Calculator
Between two date‑times
Add/Subtract a duration
Sum durations
Results
Data Source and Methodology
Authoritative Source: ISO 8601:2019 — Date and time — Representations (ISO, 2019) and IETF RFC 3339 — Date and Time on the Internet (RFC 3339, 2002).
Tutti i calcoli si basano rigorosamente sulle formule e sui dati forniti da questa fonte.
The Formula Explained
Exact difference between two moments:
Let t1 and t2 be instants (milliseconds since epoch). The signed duration in seconds is:
$$ \Delta t_s = \frac{t_2 - t_1}{1000} $$
Normalize into days, hours, minutes, seconds (absolute values shown below; keep the sign separately):
$$ d = \left\lfloor \frac{|\Delta t_s|}{86400} \right\rfloor,\quad r_1 = |\Delta t_s| - 86400\,d $$ $$ h = \left\lfloor \frac{r_1}{3600} \right\rfloor,\quad r_2 = r_1 - 3600\,h $$ $$ m = \left\lfloor \frac{r_2}{60} \right\rfloor,\quad s = r_2 - 60\,m $$
Add/Subtract a duration:
$$ S = 86400\,D + 3600\,H + 60\,M + S_c $$
$$ t' = t_0 \pm 1000\,S $$
ISO 8601 duration (PnDTnHnMnS):
$$ P[d]DT[h]H[m]M[s]S $$ with a leading minus sign if the duration is negative.
Glossary of Inputs and Outputs
- Start date and time: The initial moment for difference calculations.
- End date and time: The final moment for difference calculations.
- Base date and time: The moment to which a duration is added or from which it is subtracted.
- Duration (D/H/M/S): Interval components used for addition, subtraction, or summation.
- Signed duration: A duration with positive or negative sign depending on ordering (ISO 8601 format shown).
- Normalized breakdown: Weeks, days, hours, minutes, and seconds with proper carry/borrow.
- Total units: Duration expressed entirely in days, hours, minutes, or seconds.
Worked Example
Come Funziona: Un Esempio Passo‑Passo
Suppose Start = 2025‑03‑08 22:30:00 and End = 2025‑03‑09 01:45:30 (local time). Let t1 and t2 be their epoch times.
1) Compute the signed seconds: Δt_s = (t2 − t1) / 1000 = 11,130 seconds.
2) Normalize: d = 0; r1 = 11130. h = ⌊11130/3600⌋ = 3; r2 = 11130 − 3×3600 = 330.
m = ⌊330/60⌋ = 5; s = 330 − 5×60 = 30.
3) Result: 3 hours, 5 minutes, 30 seconds. ISO 8601: P0DT3H5M30S.
Frequently Asked Questions (FAQ)
Does the calculator handle Daylight Saving Time (DST)?
Yes. It uses your system’s local time zone database. If your interval crosses a DST boundary, the one‑hour shift is reflected in the result.
Will results be negative if End is before Start?
Yes. The signed duration shows a minus sign. The breakdown shows absolute components for clarity.
Can I add or subtract a duration?
Yes. Use the Add/Subtract mode to apply D/H/M/S to a base date‑time and get the resulting timestamp.
Do you support summing multiple intervals?
Yes. Add as many rows as needed in the Sum durations mode. The total is normalized.
Are leap seconds included?
No. Web environments follow civil time and assume uniform seconds. Leap seconds are ignored.
What format standard do you follow?
Inputs are ISO 8601 local date‑time (no time zone). Durations are output with ISO 8601 PnDTnHnMnS notation.