adding two durations
- Starting hours
- 2
- Starting minutes
- 45
- Starting seconds
- 30
- Operation
- Add
- Hours
- 1
- Minutes
- 30
- Seconds
- 45
Result4h 16m 15s
9930 + 5445 seconds, carried correctly
Open this exampleAdd or subtract two durations. Converting to seconds first avoids the carrying errors that come from working in a base-sixty system by hand.
Also called: add times together, time arithmetic.
4h 16m 15s, which is 15,375 seconds or 4.27 hours. Time carries in sixties, not tens, which is why this needs doing carefully.
Everything becomes seconds, the arithmetic happens there, and the result converts back. Doing it directly means carrying at sixty rather than ten, which is the source of nearly every manual error in time arithmetic. A negative result is reported as negative rather than wrapping around, since a duration going below zero is usually a mistake worth seeing.
convert everything to seconds, do the arithmetic, then convert backEach of these is asserted on every build. If a change to the engine ever moved one of these answers, the build would fail before the page could print it.
Result4h 16m 15s
9930 + 5445 seconds, carried correctly
Open this exampleResult-1h 0m 0s
boundary: reported rather than wrapped
Open this exampleResult2h 45m 30s
degenerate case
Open this exampleFormula version 1.0.0 · definition 1.0.0 · India · Report a problem with this calculator