Time Duration Calculator
Calculate the duration between two times in hours, minutes and seconds.
Last updated · View algorithm, constants and default inputs (JSON)
About this calculator
A duration is simply the difference between two moments, but crossing midnight or an hour boundary makes it easy to get wrong by hand. This calculator handles the wrap-around automatically.
Worked example
calculated with the default values below
Start time (HH:MM) 08:15 · End time (HH:MM) 16:45 Hours 8.500 h · Minutes 510 min · Seconds 30,600 s · Duration 8h 30m · Share of a 24-hour day 35.42 %
General background references
Disclaimer
These calculators give general date results. Public holidays, working-day conventions and time-zone rules are set locally and change, so confirm against the official calendar for anything legally or contractually binding.
Implementation source
This record describes the implementation used by this page. It is not independent validation. External references, when available, support only the stated formula or definition; estimates and custom rules retain their own assumptions.
Formula and variables
M₀ = (60h₂ + m₂) − (60h₁ + m₁); M = { M₀, M₀ ≥ 0; M₀ + 1440, M₀ < 0 }; D = M ÷ 1440 × 100%
- M,M₀
- Duration in minutes; raw difference before wrap
- h₁,m₁
- Start hour, minute
- h₂,m₂
- End hour, minute
- D
- Share of day (%)
When the end time is earlier, 1440 minutes are added (past-midnight wrap).
Frequently asked questions
Why does an end time before the start wrap past midnight correctly?
When the parsed end minutes are smaller than the start, the tool adds 1440 minutes, a full day, so 22:00 to 06:00 reads 8 hours not negative 16. Hours, minutes and seconds all derive from that adjusted minute total, and the share of day is the minutes divided by 1440 as a percent. The wrap only triggers when end is earlier than start.