Advertisement

Days between dates

Enter two dates to see how many calendar-day boundaries separate them. The count is signed, so the order of the dates does not matter for the magnitude.

Calculator

Calendar days
2

Advertisement

How this calculator works

Each date becomes its day number in the proleptic Gregorian calendar. Subtracting the start day number from the end day number gives the answer directly. Same date means zero days and adjacent dates mean one day; the endpoints are not both counted. Because the calculation never passes through a 24-hour duration, a shift to or from daylight saving time cannot change the result.

Formula

days = O(end_date) - O(start_date), where O(d) is the day number of date d with 0001-01-01 as day 1. The result is negative when the end date is earlier than the start date.

Worked example

From 2024-02-28 to 2024-03-01 is 2 days, because the leap day 2024-02-29 sits between them. From 2025-01-02 to 2025-01-01 is -1 day.

Advertisement

Frequently asked questions

Should I add one to include both dates?

This tool reports the gap between date boundaries, so 2025-01-01 to 2025-01-02 is one day. If you need inclusive counting, add one yourself after checking what the endpoint convention means for your purpose.

Does the time of day matter?

No. Both inputs are civil dates with no clock time, so the answer is always a whole number of days.

Why can the answer be negative?

The formula is signed so you can tell which date is earlier. Reversing the two dates flips the sign.

Sources

Advertisement