Connect via MCP →

Enter Calculation

Formula

Formula: Time Arithmetic Calculator
Show calculation steps (1)
  1. Normalize back

    Normalize back: Time Arithmetic Calculator

    The result in seconds is converted back to days, hours, minutes and seconds.

Advertisement

Results

Result
0 d 0 h 0 m 0 s
days / hours / minutes / seconds
Days 0
Hours 0
Minutes 0
Seconds 0

What this calculator does

The Time Arithmetic Calculator lets you do math on lengths of time expressed in days, hours, minutes and seconds. You can add two time spans, subtract one from another, multiply a span by a plain number, divide a span by a plain number, or divide one span by another to get a unitless ratio. The answer is automatically normalized back into clean days, hours, minutes and seconds.

How to use it

Enter your first time span in the Operand 1 fields. Pick an operation. If you chose add, subtract, or divide-by-time, fill in the Operand 2 time fields. If you chose multiply or divide-by-a-number, fill in the single "number" field instead. Blank fields count as zero, decimals are allowed, and negative components are accepted (a subtraction can yield a negative duration, shown with a leading minus sign).

The formula

Every span is converted to total seconds using fixed civil-day lengths: 1 day = 86400 s, 1 hour = 3600 s, 1 minute = 60 s. The chosen operation is applied in seconds, then the result is broken back down by repeatedly taking whole days, then hours, then minutes, leaving any remaining seconds (which may be fractional if your inputs were). Divide-by-time simply returns A divided by B as a pure number.

$$S = d\times86400 + h\times3600 + m\times60 + s$$

$$d=\lfloor S/86400\rfloor,\ h=\lfloor (S\bmod 86400)/3600\rfloor,\ m=\lfloor (S\bmod 3600)/60\rfloor,\ s=S\bmod 60$$

Diagram showing days, hours, minutes and seconds converting into a single total of seconds
Each time span is converted to a common unit (seconds) before arithmetic.

Worked example

Add 1 day 5 h 30 m to 20 h 45 m 30 s. First span = 106200 s, second = 74730 s, total = 180930 s. Normalizing: 2 days (172800 s) leaves 8130 s, which is 2 hours (7200 s), then 15 minutes (900 s), then 30 seconds. Result: 2 days, 2 hours, 15 minutes, 30 seconds.

$$180930 = 172800 + 8130,\quad 8130 = 7200 + 900 + 30$$
Two time bars being added and the combined bar normalized into days, hours, minutes, seconds
Adding two spans and normalizing the carry-over into clean units.

FAQ

Does it account for daylight saving or leap seconds? No. These are abstract durations, not calendar dates, so a day is always exactly 24 hours.

What happens if I divide by zero? Division by a zero number, or dividing by a zero-length time span, is undefined, so the calculator shows an error instead of a result.

Can the result be negative? Yes. Subtracting a larger span from a smaller one (or using negative inputs) produces a negative duration, displayed with a single leading minus sign.

Last updated: