Time Duration Calculator
Measure the precise duration between two date-times, down to seconds.
About Time Duration Calculator
This calculator measures the exact span between two date-time instants by differencing their UTC millisecond timestamps. That makes it accurate across month and year boundaries (which have unequal lengths) and correct across daylight-saving transitions when both times share the same local timezone. The total-second count is then decomposed into days, hours, minutes and seconds for display.
Formulas
Duration
Duration (ms) = end timestamp − start timestamp
- t_{end}
- End date-time as Unix milliseconds
- t_{start}
- Start date-time as Unix milliseconds
Decomposition
days = floor(|Δt_s| / 86400), hours = floor((|Δt_s| mod 86400) / 3600), ...
- \Delta t_{s}
- Duration in seconds
Worked example
With the default values below, Time Duration Calculator returns Duration of 08h 30m 00s. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Start Date & Time
- 2025-01-01T09:00
- End Date & Time
- 2025-01-01T17:30
- Show Seconds
- Yes
Results
- DurationExact span broken into days, hours, minutes and seconds.
- 08h 30m 00s
- Total Days
- 0.354167
- Total Hours
- 8.5000
- Total Minutes
- 510.00
- Total Seconds
- 30,600
- Total Weeks
- 0.0506
- Reversed Range
- No
Step by step
- 1Start date-time= 2025-01-01T09:00
- 2End date-time= 2025-01-01T17:30
- 3Raw difference= 30,600,000 ms
- 4Convert to seconds= 30600.000 s
- 5Decompose into d/h/m/s= 08h 30m 00s
Assumptions and limits
- The result is derived only from the 3 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 6 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
How is this different from the Date Duration Calculator?
The Date Duration Calculator works at day granularity and is designed for 'how many days between two dates' questions. This calculator works at second granularity and is designed for questions like 'how long did this process take' where hours and minutes matter.
What format should I enter date-times in?
Use ISO 8601 format: YYYY-MM-DDTHH:mm, for example 2025-06-15T08:30. Most modern browsers also accept 'June 15, 2025 08:30' but the ISO format is unambiguous.
Is this accurate across daylight-saving time changes?
Yes, because both timestamps are converted to UTC milliseconds before differencing. A 2-hour span from 1:00 AM to 3:00 AM on a spring-forward night will correctly compute as 1 hour of elapsed wall-clock time.
What happens if the start is after the end?
The duration is still computed but shown as negative. This is useful when you need to know 'how far in the past' a timestamp is.
