# What is the time duration?

Computes the elapsed time between two dates with times of day in days, hours, minutes, and seconds, and as total hours, minutes, and seconds.

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

## Default answer

Example with the default inputs (Start date September 29, 2026, Start time 09:00:00, End date October 1, 2026, End time 17:30:00) on the example date Tuesday, September 29, 2026: From September 29, 2026 9:00:00 AM to October 1, 2026 5:30:00 PM is 56.5 hours.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| startDate | Start date | The date the period starts. Today, unless you change it. |
| startTime | Start time | The time of day the period starts. |
| endDate | End date | The date the period ends. |
| endTime | End time | The time of day the period ends. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| duration | Duration | The time from the start to the end in whole days, hours, minutes, and seconds. |
| hours | Total hours | The duration in hours: seconds ÷ 3,600. |
| minutes | Total minutes | The duration in minutes: seconds ÷ 60. |
| seconds | Total seconds | The duration in seconds. |
| days | Total days | The duration in days of 24 hours: seconds ÷ 86,400. |

## Method

seconds = (end date − start date in days) × 86,400 + end time − start time in seconds; then split into days, hours, minutes, and seconds.

## Assumptions

- Every day has 24 hours: clock changes for daylight saving time and leap seconds are not counted.
- Both times are in the same time zone.
- Dates are on the Gregorian calendar, from 1600 to 2400, with its leap years.
- An end before the start gives no answer.

## Worked examples

1. startDate = 2026-09-27, startTime = 09:00:00, endDate = 2026-09-29, endTime = 17:30:00 gives duration = {"days":2,"hours":8,"minutes":30,"seconds":0}, hours = 56.5, minutes = 3,390, seconds = 203,400, days = 2.354167. Source: hand calculation in content.mdx: 2 days + 8 h 30 min = 203,400 s.
2. startDate = 2026-12-31, startTime = 23:59:30, endDate = 2027-01-01, endTime = 00:00:15 gives duration = {"days":0,"hours":0,"minutes":0,"seconds":45}, seconds = 45, minutes = 0.75. Source: hand calculation in content.mdx: 30 s to midnight plus 15 s.
3. startDate = 2024-02-28, startTime = 12:00:00, endDate = 2024-03-01, endTime = 12:00:00 gives duration = {"days":2,"hours":0,"minutes":0,"seconds":0}, hours = 48. Source: hand calculation in content.mdx: February 28 to March 1, 2024 is 2 days.
4. startDate = 2026-03-08, startTime = 01:00:00, endDate = 2026-03-08, endTime = 03:00:00 gives hours = 2. Source: hand calculation in content.mdx: 3:00 − 1:00 on a 24-hour clock is 2 hours.

## FAQ

### How do I calculate the time between two dates and times?

Turn both into seconds from one fixed point, subtract, and split the result into days, hours, minutes, and seconds. From 9:00 AM on September 27 to 5:30 PM on September 29 is 2 days plus 8 hours 30 minutes: 2 × 86,400 + 8 × 3,600 + 30 × 60 = 203,400 seconds, or 56.5 hours.

### How do I subtract times with seconds by hand?

Work from the right and borrow like in long subtraction: 60 seconds from the minutes, 60 minutes from the hours, 24 hours from the days. From 23:59:30 to 00:00:15 the next day: 15 − 30 needs a borrow, giving 45 seconds and a total of 45 seconds.

### Does it count leap years?

Yes. Dates follow the Gregorian calendar: a year divisible by 4 is a leap year, except years divisible by 100 that are not divisible by 400. From noon on February 28, 2024 to noon on March 1, 2024 is 2 days, because 2024 has a February 29.

### Does daylight saving time change the answer?

No. The calculator counts every day as 24 hours of clock time, with no time zone. On the night US clocks spring forward (March 8, 2026), 1:00 AM to 3:00 AM shows 2 hours, although only 1 hour passes. Adjust by an hour yourself if the period crosses a clock change.

### What is the difference between this and the hours calculator?

The hours calculator takes two times on the same or the next day and gives decimal hours for timesheets. This page takes a date with each time, so it handles any span, and it counts seconds.

### What if the end is before the start?

There is no answer, and the page says so. Swap the two, or fix the date.

## 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 = 3,600 s. https://www.nist.gov/pml/special-publication-811
- U.S. Naval Observatory, Leap Years: the Gregorian leap year rule (divisible by 4, except century years not divisible by 400). https://aa.usno.navy.mil/faq/leap_years
- 15 U.S.C. 260a, daylight saving time: clocks advance at 2:00 AM on the second Sunday in March. https://www.law.cornell.edu/uscode/text/15/260a
