# How do I add or subtract times?

Adds or subtracts two durations in days, hours, minutes, and seconds, or adds or subtracts a duration from a date and time of day.

- Page: https://www.acalculator.org/days/time-calculator
- JSON spec: https://www.acalculator.org/days/time-calculator.json
- Version: 42ce2b70bc5f

## Default answer

Example with the default inputs (What do you want to do? Add or subtract durations, Hours (first duration) 2, Minutes (first duration) 45, Seconds (first duration) 30, Add or subtract? Add +, Hours to add or subtract 1, Minutes to add or subtract 30, Seconds to add or subtract 45) on the example date Tuesday, September 29, 2026: The answer is 4 hours, 16 minutes, 15 seconds.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| mode | What do you want to do? | Add or subtract two durations, or add or subtract a duration from a date and time. |
| aDays | Days (first duration) | The days of the first duration. Leave it empty for 0. |
| aHours | Hours (first duration) | The hours of the first duration. Leave it empty for 0. |
| aMinutes | Minutes (first duration) | The minutes of the first duration. Leave it empty for 0. |
| aSeconds | Seconds (first duration) | The seconds of the first duration. Leave it empty for 0. |
| startDate | Start date | The date to start from. Today, unless you change it. |
| startTime | Start time | The time of day to start from. |
| op | Add or subtract? | Whether to add the second duration or subtract it. |
| bDays | Days to add or subtract | The days of the duration to add or subtract. Leave it empty for 0. |
| bHours | Hours to add or subtract | The hours of the duration to add or subtract. Leave it empty for 0. |
| bMinutes | Minutes to add or subtract | The minutes of the duration to add or subtract. Leave it empty for 0. |
| bSeconds | Seconds to add or subtract | The seconds of the duration to add or subtract. Leave it empty for 0. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| result | Result | The sum or difference of the two durations in days, hours, minutes, and seconds; or the date and time reached. |
| endDate | Date | The date reached from the start date and time. |
| endTime | Time | The time of day reached, on a 12-hour clock. |
| totalDays | In days | The result of the two durations in days: seconds ÷ 86,400. |
| totalHours | In hours | The result of the two durations in hours: seconds ÷ 3,600. |
| totalMinutes | In minutes | The result of the two durations in minutes: seconds ÷ 60. |
| totalSeconds | In seconds | The result of the two durations in seconds. |

## Method

Two durations: seconds = days × 86,400 + hours × 3,600 + minutes × 60 + seconds for each, then add or subtract and split back into days, hours, minutes, and seconds. From a date and time: move the start by the duration in seconds.

## Assumptions

- Every day has 24 hours: daylight saving clock changes and leap seconds are not counted.
- Empty boxes count as 0. Decimals are allowed (1.5 hours is 1 hour 30 minutes).
- A subtraction that goes below 0 gives a negative duration, shown with a minus sign.
- The seconds are added or subtracted unrounded, then rounded once: a duration result to the millisecond, a date and time result to the nearest second. A seconds part of the start time is kept.

## Worked examples

1. mode = durations, aHours = 2, aMinutes = 45, aSeconds = 30, op = add, bHours = 1, bMinutes = 30, bSeconds = 45 gives result = 4 hours, 16 minutes, 15 seconds, totalSeconds = 15,375, totalMinutes = 256.25. Source: hand calculation in content.mdx: 30 + 45 = 75 s = 1 min 15 s; 45 + 30 + 1 = 76 min = 1 h 16 min; 2 + 1 + 1 = 4 h.
2. mode = durations, aDays = 1, aHours = 3, op = subtract, bHours = 5, bMinutes = 20 gives result = 21 hours, 40 minutes, totalHours = 21.666667. Source: hand calculation in content.mdx: 27 h − 5 h 20 min = 21 h 40 min.
3. mode = durations, aMinutes = 90, op = subtract, bHours = 2 gives result = -30 minutes, totalSeconds = -1,800. Source: hand calculation in content.mdx: 90 min − 120 min = −30 min.
4. mode = durations, aHours = 1.5, op = add, bMinutes = 0.25 gives result = 1 hour, 30 minutes, 15 seconds, totalSeconds = 5,415. Source: hand calculation in content.mdx: 1.5 h = 5,400 s; 0.25 min = 15 s.
5. mode = clock, startDate = 2026-09-27, startTime = 22:30:00, op = add, bHours = 8, bMinutes = 45 gives result = Monday, September 28, 2026, 7:15:00 AM, endDate = 2026-09-28, endTime = 07:15:00. Source: hand calculation in content.mdx: 22:30 + 8:45 = 31:15, which is 7:15 the next day.
6. mode = clock, startDate = 2026-03-01, startTime = 06:00:00, op = subtract, bDays = 1, bHours = 7 gives endDate = 2026-02-27, endTime = 23:00:00. Source: hand calculation in content.mdx: back 1 day to February 28, 6:00 AM, then 7 hours to 11:00 PM on February 27.

## FAQ

### How do I add hours and minutes?

Add each unit on its own, then carry: 60 seconds make a minute, 60 minutes make an hour, and 24 hours make a day. 2:45:30 plus 1:30:45 is 75 seconds (1 minute 15 seconds), 76 minutes (1 hour 16 minutes), and 4 hours: 4 hours, 16 minutes, 15 seconds.

### How do I subtract time?

Subtract each unit, borrowing from the next unit up when you run short. 1 day 3 hours minus 5 hours 20 minutes: borrow 1 hour for 60 minutes, so 60 − 20 = 40 minutes, then 26 − 5 = 21 hours: 21 hours 40 minutes. If the second time is longer, the answer is negative.

### What time will it be 8 hours and 45 minutes from 10:30 PM?

22:30 + 8:45 = 31:15 on a 24-hour clock. That is past 24:00, so it is the next day at 7:15 AM. Pick "Change a date and time" to get the date too.

### Can I use decimals?

Yes. 1.5 hours is 1 hour 30 minutes, and 0.25 minutes is 15 seconds. Empty boxes count as 0.

### How do I convert the result to hours or minutes?

The page shows the total in days, hours, minutes, and seconds. 4 hours 16 minutes 15 seconds is 15,375 seconds, 256.25 minutes, or 4.2708 hours.

### Does it count daylight saving time?

No. Every day is 24 hours of clock time. If you add time across a clock change, the real time is an hour off the clock time shown.

## Sources

- NIST Special Publication 811 (2008), Guide for the Use of the International System of Units: 1 d = 24 h = 86,400 s, 1 h = 60 min = 3,600 s. https://www.nist.gov/pml/special-publication-811
- U.S. Naval Observatory, Leap Years: the Gregorian leap year rule. https://aa.usno.navy.mil/faq/leap_years
