ThisCalculator

Date and time

Calculate Day and Time Between Two Dates

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

Calculate Day and Time Between Two Dates

This calculator finds the elapsed time between a starting date and time and an ending date and time. Enter both dates and clock times to get the duration in days, hours, and minutes; the result uses elapsed time rather than counting calendar dates inclusively.

Formula

Convert each date and time to a single count of minutes, then subtract the start count from the end count. In symbols, elapsed minutes = end minute count − start minute count, and elapsed days = elapsed minutes ÷ 1,440. A day contains 24 hours, or 1,440 minutes.

For a Gregorian calendar date, the date’s day number can be calculated as 365y + floor((y−1)/4) − floor((y−1)/100) + floor((y−1)/400) + floor((153(m′+12)−3)/5) + d−1, where January and February are treated as months 13 and 14 of the preceding year. More directly, the calculator’s expression applies the equivalent month adjustment. Here, y is the year, m the month number from 1 to 12, d the day of the month, h the hour from 0 to 23, and n the minute from 0 to 59. The floor function rounds down to the next integer.

The day output is a decimal number of 24-hour periods. The duration output displays the same interval as hours, minutes, and seconds; the inputs are precise to a minute, so seconds will be zero. Enter a valid Gregorian date and use the same time basis for both endpoints.

Worked Example

Using the defaults, the start is January 1, 2025 at 09:00 and the end is January 3, 2025 at 09:00. The dates are two calendar days apart, and the clock time is identical.

  1. Convert the start to a day count and time: January 1, 2025 is day count 739,251; 09:00 adds 9 × 60 = 540 minutes.
  2. Convert the end: January 3 is day count 739,253; 09:00 also adds 540 minutes.
  3. Subtract: (739,253 × 1,440 + 540) − (739,251 × 1,440 + 540) = 2,880 minutes.
  4. Convert to days: 2,880 ÷ 1,440 = 2.00 days, or 48:00:00.

How to Calculate the Time Between Dates

To calculate an interval yourself, first establish the exact start and end—not just the dates, but the times if hours matter. Then count the days separating them, account for the time-of-day difference, and express the result in the units you need. Subtracting the earlier timestamp from the later one avoids confusion over whether to include the first or last date.

  • For two times on the same date, subtract the start time from the end time.
  • For dates several days apart, add the full days and adjust for the difference between the two clock times.
  • For a duration in hours, multiply elapsed days by 24. For minutes, multiply by 1,440; for seconds, multiply by 86,400.

For example, from Monday at 10:00 to Tuesday at 09:00 is 23 hours, not one full day. The calendar dates differ by one, but the exact elapsed duration is one hour short of 24 hours.

Elapsed Time Versus Calendar-Day Counting

“How many days?” can refer to different things. Elapsed days measure a continuous duration in 24-hour units. Calendar-day counting counts date boundaries or dates touched by an interval. From January 1 at 23:00 to January 2 at 01:00, only two hours elapse, even though the interval touches two calendar dates.

Inclusive counting is another convention. If a project runs from January 1 through January 3 and both dates count as working days, that is three named calendar dates. But the elapsed time from midnight on January 1 to midnight on January 3 is two days. Choose the convention that matches your question: duration, nights, or count of dates.

Time Zones and Daylight Saving Changes

This calculation treats the entered times as ordinary clock values on a continuous 24-hour calendar. It does not know the location, time zone, or whether clocks changed between the endpoints. For events in different time zones, convert both timestamps to a shared reference—usually UTC—before finding elapsed time.

Daylight saving transitions can make the difference between local clock readings misleading. In a location where clocks move forward, a local interval that appears to span two calendar days may contain an unusual number of actual hours; when clocks move back, a local hour may occur twice. If actual elapsed duration matters, use unambiguous timestamps with time-zone information and a time-zone-aware calculation. The calculator is suited to date-time arithmetic where each entered day is treated as 24 hours.

Common Input Errors and Limits

  • Invalid dates: Check that the month has the selected day. February has 28 days in a common year and 29 in a leap year.
  • Wrong year format: Enter the full year, such as 2025, not “25.”
  • Mixing time conventions: Use 24-hour clock values. For example, 3 p.m. is 15:00, not 3:00.
  • Reversed endpoints: If the end precedes the start, subtraction gives a negative duration. Swap the endpoints if you want a positive interval.
  • Rounding: Decimal days can hide small differences. A result of 1.5 days means 36 hours; it does not mean one calendar day and a half in every date-counting convention.

The formula follows Gregorian calendar leap-year rules: years divisible by 4 are leap years, except century years unless divisible by 400. It does not cover calendar systems with different rules, leap seconds, or location-specific clock changes. For dates in the distant past, remember that historical adoption of the Gregorian calendar varied by country; a modern arithmetic result may not match a local historical calendar.

Frequently Asked Questions

How many hours are in a day?
A standard elapsed day is 24 hours, or 1,440 minutes. A local calendar day around a daylight saving change can contain a different number of elapsed hours.

How do I count days between two dates?
Subtract the earlier date and time from the later one for elapsed duration. If you mean inclusive calendar dates, count both the start and end dates instead; that is a different result.

Does the calculator include the start date?
It measures elapsed time from the exact start moment, so it does not add an extra day simply because the start date is present. Use inclusive counting separately when the task requires counting dates touched.

How do I calculate days between dates in Excel?
Subtract the earlier date-time cell from the later one. Spreadsheet dates are stored as day values, so a result of 2.5 represents 2 days and 12 hours; format the result as a number or duration to display it as intended.

Why is the answer different across a daylight saving change?
Clock time and elapsed time are not always the same across a clock transition. A time-zone-aware calculation can account for the change; a simple date-and-time subtraction cannot infer it without location and time-zone data.

Related

Formula used
in sy | Start year | - | 2025 | 0
in sm | Start month | - | 1 | 0
in sd | Start day | - | 1 | 0
in sh | Start hour | h | 9 | 0
in sn | Start minute | min | 0 | 0
in ey | End year | - | 2025 | 0
in em | End month | - | 1 | 3 | 0
in ed | End day | - | 2 | 0
in eh | End hour | h | 9 | 0
in en | End minute | min | 0 | 0
out days | Elapsed days | days | ((ey * 365 + floor((ey - 1) / 4) - floor((ey - 1) / 100) + floor((ey - 1) / 400) + floor((153 * (em + (em > 2 ? 0 : 12) - 3) + 2) / 5) + ed - 1) * 1440 + eh * 60 + en - ((sy * 365 + floor((sy - 1) / 4) - floor((sy - 1) / 100) + floor((sy - 1) / 400) + floor((153 * (sm + (sm > 2 ? 0 : 12) - 3) + 2) / 5) + sd - 1) * 1440 + sh * 60 + sn)) / 1440 | 2
out duration | Elapsed time | min | ((ey * 365 + floor((ey - 1) / 4) - floor((ey - 1) / 100) + floor((ey - 1) / 400) + floor((153 * (em + (em > 2 ? 0 : 12) - 3) + 2) / 5) + ed - 1) * 1440 + eh * 60 + en - ((sy * 365 + floor((sy - 1) / 4) - floor((sy - 1) / 100) + floor((153 * (sm + (sm > 2 ? 0 : 12) - 3) + 2) / 5) + sd - 1) * 1440 + sh * 60 + sn) | time

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.