How Many Days Are Between Two Dates?
Subtract the earlier date from the later one — but decide first whether the end date counts. See both conventions and the leap year and DST traps.
Counting days between two dates is subtraction with one decision attached: does the end date count? Everything that goes wrong with these calculations traces back to that question or to a leap year.
The Two Conventions
Take Monday 3 August to Friday 7 August 2026:
- Exclusive (end date not counted) — 4 days. This is the gap between the dates, and what you want for "days until" or "days since".
- Inclusive (both dates counted) — 5 days. This is the length of the span, and what you want for a hotel stay, a leave request or a project duration.
Neither is more correct. But a contract that says "within 5 days" without specifying which one has a built-in argument. The [date difference calculator](/tools/date-difference) has a switch for it so you can see both.
Doing It by Hand
For dates within the same year, convert both to a day-of-year number and subtract. 7 August 2026 is day 219; 3 August is day 215; the difference is 4. The [day of year tool](/tools/day-of-year) gives that number directly.
Across years, count the whole years between, add 1 for each leap day that falls inside the span, then adjust for the partial years at each end.
The Traps
Leap days. Any span crossing 29 February gains a day. Spans measured in "years × 365" are wrong by one day per leap year crossed — over a 36-year span that is nine days.
Daylight saving. This is the one that breaks software rather than people. A range from June to December crosses a clock change, so it contains one 23-hour or 25-hour day. Code that divides elapsed milliseconds by 86,400,000 and rounds down loses a day. Calendar-date arithmetic avoids it entirely; elapsed-time arithmetic does not.
Month-end. "One month after 31 January" has no obvious answer. Most systems clamp to 28 or 29 February rather than spilling into March. See [add or subtract days from a date](/blog/add-subtract-days-from-date).
Business Days Are a Different Question
Days between dates counts every day. If you need only working days, weekends and holidays have to come out — and holidays are local, so no general answer exists. The [working days calculator](/tools/working-days) takes your own holiday list.
Weeks, Months and Years
Once you have the day count, weeks are a clean division by seven. Months and years are not: they vary in length, so "how many months between" is counted as completed calendar months, not by dividing days. 31 January to 28 February is one month and also 28 days.