Elapsed Days and Time Between Two Date-Times

Elapsed Days and Time Between Two Date-Times

Growing AI Skill PRO

Enter Calculation

Formula

Δt=(JDNe−JDNs)·86400+(Te−Ts)where{Ts=3600Start Hour+60Start Min+Start SecTe=3600End Hour+60End Min+End Sec\begin{gathered} \Delta t = \left(\text{JDN}_{e} - \text{JDN}_{s}\right)\cdot 86400 + \left(T_{e} - T_{s}\right) \\[1.5em] \text{where}\quad \left\{ \begin{aligned} T_{s} &= 3600\,\text{Start Hour} + 60\,\text{Start Min} + \text{Start Sec} \\ T_{e} &= 3600\,\text{End Hour} + 60\,\text{End Min} + \text{End Sec} \end{aligned} \right. \end{gathered}
Show calculation steps (1)
  1. Julian Day Number (per date)

    JDN=D+⌊153m+25⌋+365y+⌊y4⌋−⌊y100⌋+⌊y400⌋−32045where{a=⌊14−M12⌋y=Y+4800−am=M+12a−3\begin{gathered} \text{JDN} = D + \left\lfloor \frac{153m + 2}{5} \right\rfloor + 365y + \left\lfloor \frac{y}{4} \right\rfloor - \left\lfloor \frac{y}{100} \right\rfloor + \left\lfloor \frac{y}{400} \right\rfloor - 32045 \\[1.5em] \text{where}\quad \left\{ \begin{aligned} a &= \left\lfloor \frac{14 - M}{12} \right\rfloor \\ y &= Y + 4800 - a \\ m &= M + 12a - 3 \end{aligned} \right. \end{gathered}

    a = floor((14 - Month)/12), y = Year + 4800 - a, m = Month + 12a - 3. The Western year adds the era base (e.g. Showa 1925) to the entered year. The same JDN formula is applied to both the start and end date.

Usage stats

Advertisement

Results

Elapsed days (end - start)
0.96735
days
Weeks + days 0 weeks + 0 days
Days + hours 0 days + 23.2164 hours
Total hours 23.216389 hours
Total minutes 1,392.983333 minutes
Total seconds 83,579 seconds
Days + H:M:S 0 days + 23:12:59

Report an error on this page

What this calculator does

This tool computes the exact amount of time between a start date-time and an end date-time (end minus start). It returns the difference in several equivalent forms: total days, a weeks-plus-days split, a days-plus-hours split, total hours, total minutes, total seconds, and a clean days plus HH:MM:SS breakdown. It works for any proleptic-Gregorian calendar date, so it is universal and not tied to any country.

Timeline showing a start date-time and end date-time with the elapsed span between them
The elapsed duration is the end date-time minus the start date-time.

How to use it

Enter the start year, month, day and (optionally) the hour, minute and second, then do the same for the end date-time. Leave the time fields at 0 if you only care about whole days. The "era" dropdown defaults to CE / AD (Western year), where the year you type is used directly. The Japanese imperial era options (Meiji, Taisho, Showa, Heisei, Reiwa) are a regional convenience: they simply add a fixed offset to convert the typed year into a Western year before any math runs, so the elapsed result is identical regardless of era choice.

The formula explained

Each date is converted to a Julian Day Number (JDN) using the Fliegel-Van Flandern algorithm, which gives a continuous whole-day count that correctly handles leap years (including the century rule) and varying month lengths. The time of day is added as seconds. The elapsed seconds are then

$$\Delta t = \left(\text{JDN}_{e} - \text{JDN}_{s}\right)\cdot 86400 + \left(T_{e} - T_{s}\right)$$

and every other unit is derived by dividing or splitting that single number.

Advertisement
Diagram breaking total elapsed seconds into weeks, days, hours, minutes and seconds
Total seconds are converted into weeks, days, hours, minutes and seconds.

Worked example

Start: 2024-01-01 00:00:00. End: 2024-03-01 12:00:00. Because 2024 is a leap year, January (31) plus February (29) gives 60 whole days, plus a half day for 12:00, so the difference is \(60.5\) days \(= 5{,}227{,}200\) seconds \(= 1{,}452\) hours \(= 87{,}120\) minutes. The breakdown is 8 weeks + 4 days, or 60 days + 12:00:00.

Time Unit Conversion Reference

The calculator reports elapsed time in units that have an exact, fixed length. These are the equivalences it uses:

Unit Seconds Minutes Hours Days
1 minute 60 1 1/60 1/1,440
1 hour 3,600 60 1 1/24
1 day 86,400 1,440 24 1
1 week 604,800 10,080 168 7

In short: 1 week = 7 days = 168 hours = 10,080 minutes = 604,800 seconds.

Why months and years are not in the output: months last 28 to 31 days and years last 365 or 366 days, so they are not fixed lengths. A result in weeks, days, hours, minutes and seconds is unambiguous. For long spans, the mean Gregorian year of 365.2425 days (31,556,952 seconds) is only an average, not the length of any particular year.

How to Calculate Elapsed Time by Hand

  1. Convert each date to a day count. Use a Julian Day Number (JDN) or any continuous day count, so that \(\text{JDN}_s\) is the start date and \(\text{JDN}_e\) is the end date.
  2. Convert each time of day to seconds. \(T = 3600h + 60m + s\) for the start and for the end.
  3. Subtract the day counts and multiply by 86,400. This gives \((\text{JDN}_e - \text{JDN}_s)\cdot 86400\).
  4. Add the difference in time-of-day seconds. \(\Delta t = (\text{JDN}_e - \text{JDN}_s)\cdot 86400 + (T_e - T_s)\). The time-of-day difference may be negative; that is fine, because it borrows from the day term.
  5. Split the total into units with integer division and remainders. Weeks = \(\lfloor \Delta t / 604800 \rfloor\). Days come from the remainder divided by 86,400, hours from the next remainder divided by 3,600, minutes from the next divided by 60, and seconds are what is left.

Example with a negative time-of-day difference: from 2023-12-31 22:00:00 to 2024-01-01 06:00:00.

  • Day difference: 1 day, so \(1 \cdot 86400 = 86400\) s.
  • \(T_s = 3600\cdot 22 = 79200\) s and \(T_e = 3600\cdot 6 = 21600\) s, so \(T_e - T_s = -57600\) s.
  • \(\Delta t = 86400 - 57600 = 28800\) s.
  • \(28800 / 3600 = 8\), so the result is 0 days and 8 hours. The negative time difference borrowed one day (24 h) from the day count.

Example of splitting: a total of 1,000,000 s. \(1000000 = 1\cdot 604800 + 395200\), so 1 week. \(395200 = 4\cdot 86400 + 49600\), so 4 days. \(49600 = 13\cdot 3600 + 2800\), so 13 hours. \(2800 = 46\cdot 60 + 40\), so 46 minutes and 40 seconds. The result is 1 week, 4 days, 13 h, 46 min, 40 s.

Advertisement

Key Terms and Limitations

  • Elapsed time: the length of time from a start date-time to an end date-time (end minus start). It is negative if the end is earlier than the start.
  • Julian Day Number (JDN): an integer count of days from a fixed origin in astronomical convention (4713 BC, noon). Subtracting two JDNs gives the exact number of calendar days between two dates. For example, 2000-01-01 has JDN 2,451,545.
  • Proleptic Gregorian calendar: the Gregorian calendar rules extended backward to dates before its introduction in 1582, as if it had always been in use. Historical dates before the adoption date in a given country may therefore differ from the records of the time.
  • Leap year rule (Gregorian): a year is a leap year if it is divisible by 4, except years divisible by 100, unless they are also divisible by 400. So 2000 and 2024 are leap years; 1900 and 2023 are not.
  • Inclusive vs. exclusive day counting: exclusive counting (used here) measures the difference, so Monday to Tuesday is 1 day. Inclusive counting also counts the starting day, which gives 2. Add 1 day to the result if you need the inclusive count.
  • Japanese era offsets: the Gregorian year is the era year plus the offset: Meiji 1867, Taisho 1911, Showa 1925, Heisei 1988, Reiwa 2018. For example, Reiwa 6 = 2018 + 6 = 2024, and Showa 64 = 1925 + 64 = 1989. "W" means a Western (Gregorian) year entered directly.

Limitations: the inputs are treated as a single timeless clock. No time zone, daylight-saving shift or leap second is applied. Real-world elapsed time across a daylight-saving change can therefore differ by one hour from the result here, and across time zones by the zone offset.

FAQ

Can the result be negative? Yes. If the end is before the start, the totals are negative; the breakdown rows show the magnitude.

Does it count both endpoints? No. It measures the elapsed interval (end minus start), not an inclusive day count.

Are leap years handled? Yes, automatically, including the rule that years divisible by 100 are not leap years unless also divisible by 400.

Last updated:

Most popular in Time and Date

View all Time and Date calculators