Skip to the calculator
Rule Calculator

Time Calculator

Formula and sources checked · How we check

Add or subtract two durations in hours, minutes and seconds, with the decimal hours payroll and billing want.

Operation Add, Hours 3 hours, Minutes 45 minutes, Hours 2 hours

6:05:30

Result for the example below. Change any field and the number follows, with the working underneath.

Result
6:05:30
First duration in seconds
h1 * 3600 + m1 * 60 + s113,500 s
Second duration in seconds
h2 * 3600 + m2 * 60 + s28,430 s
Result in seconds
operation_add * (first + second) + operation_subtract * (first - second)21,930 s
As a clock reading
total6:05:30
Whole hours
fix(abs(total) / 3600) * sign(total)6 hours
Minutes past the hour
floor(mod(abs(total), 3600) / 60)5 minutes
Seconds past the minute
mod(abs(total), 60)30 seconds
Decimal hours
total / 36006.092 hours
Total minutes
total / 60365.5 minutes
In days and hours
total / 864000.254 days

Ask about this in the chat

Worked example

3:45:00 plus 2:20:30 is 6:05:30, because 45 and 20 minutes carry an hour between them. In decimal hours that is 6.0917, and a timesheet reading 6.05 would be short by four minutes on this one entry.

How to work it out yourself

  1. 1.Enter each duration in hours, minutes and seconds. Leave a field at zero rather than converting it yourself.
  2. 2.Time carries in sixties, not tens, which is why adding 45 and 20 minutes gives 1:05 and not 65. Converting to seconds first and back at the end removes the carry entirely.
  3. 3.Read the decimal hours line before typing anything into payroll or an invoice. 6:05 is 6.0833 hours, not 6.05, and the difference compounds over a month.

The formula

  1. First duration in secondsh1 * 3600 + m1 * 60 + s1
  2. Second duration in secondsh2 * 3600 + m2 * 60 + s2
  3. Result in secondsoperation_add * (first + second) + operation_subtract * (first - second)
  4. As a clock readingtotal
  5. Whole hoursfix(abs(total) / 3600) * sign(total)
  6. Minutes past the hourfloor(mod(abs(total), 3600) / 60)
  7. Seconds past the minutemod(abs(total), 60)
  8. Decimal hourstotal / 3600
  9. Total minutestotal / 60
  10. In days and hourstotal / 86400

Source: BIPM SI Brochure — the second, and units accepted for use with the SI, US Department of Labor, 29 CFR 785.48 — recording and rounding working time

Questions people actually ask

Why is 6:05 not 6.05 hours?
Because minutes are sixtieths of an hour, not hundredths. Five minutes is 5/60 of an hour, which is 0.0833, so 6:05 is 6.0833 hours. Reading the clock straight into a decimal field understates every entry whose minutes are under 60 and is the commonest timesheet error there is.
Can the result be negative?
Yes, and it is shown as one. Subtracting a longer duration from a shorter one is a real question — how much short a session ran, how far past a budget — and hiding the sign would turn a deficit into a surplus.
How is this different from the hours worked calculator?
That one takes clock-in and clock-out times, handles a break and applies a rounding policy, which is a timesheet. This one adds and subtracts bare durations, which is what you want for stacking session lengths, splitting a budget, or checking a total.
Does it handle durations over 24 hours?
Yes. The clock reading keeps counting rather than wrapping, so 30 hours reads as 30:00:00 and not 6:00:00, and the days line is there when that is the more useful shape.

Related

Put this calculator on your site

Free, no attribution required beyond the link.

<iframe src="https://rulecalculators.com/embed/time-calculator" width="100%" height="420" style="border:1px solid #e7e4de;border-radius:12px" title="Time Calculator"></iframe>