Are you counting elapsed calendar steps or included dates?
January 1 to January 2 is one step between calendar dates, but two dates if both endpoints are included. Neither description is complete without a counting rule. This calculator returns the signed interval and excludes the starting day; choose any inclusive interpretation separately.
The same dates can answer two different questions.
A duration measures the gap between dates. An inclusive count measures every calendar date in the interval, including both ends.
- Elapsed calendar days
- 2 days — the result this tool reports
- Count both endpoints
- 3 calendar dates in the interval
2024-02-28 to 2024-03-01: 2 elapsed days, or 3 calendar dates when counting both ends.
The leap-day example contains February 28, February 29, and March 1. There are two gaps between those three dates.
Elapsed = (end at UTC midnight − start at UTC midnight) ÷ 86,400,000. Count both endpoints = |elapsed| + 1. A reversed interval gives negative elapsed days but a positive count of dates. The same date gives 0 elapsed days and 1 inclusive date.
This is a calendar-date calculation. It does not measure clock hours, exclude weekends, or count business days. UTC midnight keeps time-zone and daylight-saving changes out of the result.
Worked examples
- Starting point
- 2024-02-28 to 2024-03-01.
- Result
- 2 days; the same dates in 2025 are 1 day apart.
- Why it happens
- 2024 includes February 29. The interval crosses that extra calendar date; a fixed assumption that February always has 28 days gives the wrong result.
- Starting point
- 2026-01-10 to 2026-01-10.
- Result
- 0 days apart; 1 included calendar date if counting both endpoints.
- Why it happens
- No transition to another date occurs. An inclusive event-day count answers a different question, even when the endpoints are identical.
- Starting point
- 2026-01-31 to 2026-01-01.
- Result
- −30 days.
- Why it happens
- The sign records the reversed direction. If only the number of included dates matters, order the endpoints first; January 1 through January 31 contains 31 dates.
Choose for the job
- You need the interval from a start date to an end date.
- Use the result as shown. Weekends and holidays are included, and reversing the inputs reverses the sign.
- You need all dates in an inclusive, forward range.
- Add one to a non-negative interval. Confirm that both endpoints really belong in the count rather than assuming every deadline uses that convention.
Calendar days are not elapsed local-time hours
A daylight-saving transition can make a local day 23 or 25 hours long. This tool still counts one calendar step. It does not calculate work hours, time-of-day durations or a holiday-aware business interval.
How these examples are derived
Valid YYYY-MM-DD dates from 0001 through 9999 are represented at UTC midnight. End minus start is divided by 86,400,000 milliseconds. This applies Gregorian calendar rules across the supported range and does not model historical local calendar changes.
How to use date difference
Calculate a calendar date interval without time-zone or daylight-saving differences. The starting day is excluded from the count.
- Choose the start date.
- Choose the end date.
- Read the number of days. Reverse the dates to see the same interval as a negative number.
A month-end interval
January 1 to January 31 is 30 days. January 1 to January 1 is 0 days. February 28 to March 1 is 2 days in a leap year and 1 day in a non-leap year.
Good to know
- The calculation compares calendar dates using UTC and ignores times of day.
- It counts weekends and holidays. It is not a business-day or work-hours calculator.
- For an inclusive count of both calendar dates, add one to a non-negative interval.
Common questions
Will daylight saving time change the answer?
No. The calculation uses UTC calendar dates instead of the local time elapsed between midnights, so a 23-hour or 25-hour day does not affect the count.
Can the answer be negative?
Yes. An end date earlier than the start date gives a negative interval, which makes the direction of the comparison clear.