SOLVETUTORMATH SOLVER

Instrument MI-06-065 · Everyday life

Clock Duration Calculator

Enter a start and end time on the clock and this instrument returns the exact duration between them — rolling past midnight automatically when the end time is earlier than the start.

Instrument MI-06-065
Sheet 1 OF 1
Rev A
Verified
Type 06 — Calendar SER. 2026-06065

Duration — hours

8

hours = floor(diff seconds / 3600), wrapping to next day if end < start

25 Duration — minutes
0 Duration — seconds
The working Every figure verified twice
  1. durH = floor((if(16·3600 + 13·60 + 0 < 7·3600 + 48·60 + 0, 86400, 0) + (16·3600 + 13·60 + 0) − (7·3600 + 48·60 + 0)) ⁄ 3600) = 8
  2. durM = floor((if(16·3600 + 13·60 + 0 < 7·3600 + 48·60 + 0, 86400, 0) + (16·3600 + 13·60 + 0) − (7·3600 + 48·60 + 0)) mod 3600 ⁄ 60) = 25
  3. durS = (if(16·3600 + 13·60 + 0 < 7·3600 + 48·60 + 0, 86400, 0) + (16·3600 + 13·60 + 0) − (7·3600 + 48·60 + 0)) mod 60 = 0
Worksheet log
  1. No entries yet — change an input to log a scenario.

How this instrument works

Subtracting two times on a 24-hour clock looks like simple arithmetic until the end time is earlier than the start time — a night shift that starts at 22:00 and ends at 02:30 the next morning doesn't produce a negative duration, it wraps around midnight and continues on the other side. That wraparound is the one part of clock-time subtraction that trips up a plain calculator: without it, 02:30 minus 22:00 gives an incorrect negative result instead of the true 4-hour-30-minute shift.

This instrument works entirely in seconds since midnight to sidestep that trap. It converts both the start and end time to seconds past 00:00:00, and if the end time's total comes out smaller than the start time's, it adds a full day (86,400 seconds) before subtracting — the same logic a payroll system or shift-scheduling tool uses internally. The result then converts back into a readable hours-minutes-seconds duration.

The same math handles same-day spans without any special casing — a coffee break from 9:15:30 to 9:45:10, for instance, is a plain 29-minute-40-second gap, no wraparound needed. Whether you're timing a shift, a workout interval, or the gap between two logged timestamps, entering the clock-face times directly is faster and less error-prone than converting everything to minutes by hand first.

T=3600H+60M+ST = 3600H + 60M + Sd=(TeTs+86400)mod86400d = (T_e - T_s + 86400) \bmod 86400
Start and end times are each converted to seconds since midnight. If the end total is smaller than the start total, a full day (86,400 s) is added first, so the result always wraps forward through midnight instead of going negative — then it's split back into hours, minutes, and seconds.
  • Enter the start time's hour, minute, and second using the 24-hour clock (0-23 for hours).
  • Enter the end time the same way — hour, minute, and second.
  • Read the duration below in hours, minutes, and seconds.
  • If the end time is earlier than the start time, the calculator assumes it falls on the next day and adds 24 hours before subtracting.
  • Double-check hour entries use 24-hour format (13 for 1pm, not 1) — this is the most common source of a wrong result.

Worked example — an 8-hour 25-minute workday

A worker clocks in at 7:48:00 and clocks out at 16:13:00 (4:13 PM). Converted to seconds since midnight: start = 7×3600 + 48×60 + 0 = 28,080 s; end = 16×3600 + 13×60 + 0 = 58,380 s. Since the end total is larger, no midnight wraparound is needed: 58,380 − 28,080 = 30,300 seconds.

30,300 seconds converts to 8 hours, 25 minutes, 0 seconds exactly (30,300 ÷ 3600 = 8 remainder 1,500 s; 1,500 ÷ 60 = 25 remainder 0) — an 8-hour-25-minute shift, the precise figure a timesheet needs for payroll.

Questions

Why does the result sometimes roll into the next day?

Whenever the end time you enter is earlier on the clock than the start time — like an overnight shift running 22:00 to 02:30 — the calculator assumes the end time happened after midnight on the following day rather than returning a nonsensical negative duration. For that example it computes 4 hours 30 minutes, treating 02:30 as 26:30 relative to the 22:00 start.

Can I enter times in 12-hour AM/PM format?

No — the hour fields expect 24-hour (military) format, 0 through 23. Convert AM/PM times first: times from 1 AM to 11 AM stay the same number, 12 PM (noon) becomes 12, and 1 PM through 11 PM become 13 through 23. Entering "1" for 1 PM instead of "13" is the single most common mistake, and it silently produces an 8-hour-off result.

What happens if the start and end times are exactly the same?

The duration comes out as 0 hours, 0 minutes, 0 seconds. The wraparound logic only triggers when the end time is strictly earlier than the start time, so an identical start and end is treated as a zero-length span on the same day rather than a full 24-hour wrap.

How do I subtract an unpaid lunch break from a shift's duration?

Run this calculator twice: once for the full clock-in-to-clock-out span, and once for the break's start and end time, then subtract the break's duration from the shift's duration by hand (or with a separate minutes-total tool). The calculator itself only handles one continuous start-to-end span at a time.

Can this handle spans longer than 24 hours, like a multi-day trip?

No — it only ever adds a single day (24 hours) when wrapping, so it's built for same-day or overnight (single-midnight) spans, not multi-day durations. For a gap measured in days plus hours across calendar dates, use a date-and-time duration calculator instead, which tracks the actual calendar dates rather than just clock-face times.

References