“How many days between two dates” sounds like subtraction, and it is, right up until the off-by-one question, the leap year rules, and the discovery that “one month later” has no fixed meaning. Calendar math is genuinely tricky in exactly three places, and knowing them turns every deadline, age, and countdown calculation reliable. This guide covers all three, with our free date difference calculator doing the arithmetic that calendars make annoying.
In this guide
The off-by-one: counting days vs counting nights
From Monday June 8 to Friday June 12 is 4 days by subtraction, and 5 days if you count both endpoints, and both answers are correct for different questions. Subtraction (exclusive counting) answers “how much time passes”: nights in a hotel, days of interest accrued, age in days. Inclusive counting answers “how many dates are involved”: days of a rental you pay for, days a banner is displayed, working days in a span where both ends count. Most date-math arguments are two people answering different questions with the same numbers. The fix is naming the convention before computing: a calculator subtracts, so when your situation counts both endpoints, add one, deliberately and visibly.
Leap years: the rule with two exceptions
The full rule, worth knowing exactly because it is short: a year is a leap year if it divides by 4, except century years, which must divide by 400. So 2024 was a leap year, 2100 will not be, and 2000 was, the rare century that passed the 400 test. The reason is that the actual solar year is about 365.2425 days, and the every-4-years patch overshoots slightly, so centuries skip the patch except every fourth century. Practical consequences: any span crossing February of a leap year is one day longer than naive month-math suggests, “a year” is sometimes 366 days for interest and deadline purposes, and the leap year checker settles any specific year instantly. Calendar-accurate tools handle all this internally; back-of-envelope month-times-30 arithmetic does not, which is where most spreadsheet date bugs are born.
Why “one month later” is ambiguous
Days are fixed-size; months are not, and that breaks “add a month” at the edges. What is January 31 plus one month? February has no 31st, so systems must choose: clamp to the month’s end (February 28 or 29), or overflow into March. Different software chooses differently, both choices are defensible, and contracts have been argued over the gap. The same ambiguity makes “months between dates” soft at the edges: from January 31 to March 1 is one month by some counts and barely-one-month-and-a-day by others. The honest practice: for anything with consequences, deadlines, billing, notice periods, specify in days or specify the exact date, and let “months” be the human-friendly approximation rather than the binding unit.
Age: the difference that has a birthday rule
Age is a date difference with a cultural convention attached: you are N years old until the moment your birthday arrives, then N+1, regardless of how many leap days the span contained. Someone born June 20, 1990 is still 35 on June 5, 2026, fifteen days short of the birthday, even though more than 35 calendar years of days have nearly elapsed. Implementations get this wrong by dividing days by 365.25 and rounding, which drifts near birthdays; correct age math compares month and day directly, which is what the age calculator does, along with the fun derived figures, age in days, weeks, and the date of the ten-thousandth day.
Worked examples
- January 1 to June 5, 2026: 155 days by subtraction, 156 inclusive. Same span, two correct answers, one convention choice.
- A 90-day notice period from June 5, 2026: count forward by days, never “three months”, because the months answer shifts with which months are involved.
- Interest on a deposit across February 2024: the leap day is a real day of interest; calendar-accurate counting picks it up, month-times-30 misses it.
For spans measured in working days rather than calendar days, and the holiday wrinkle that comes with them, the topic continues in the business days guide, and the whole family of calculators lives in the date and time tools hub. Two close relatives have guides of their own: timesheet math for hours worked across shifts, and countdowns and elapsed time for the distance to a date that has not arrived yet.
Frequently asked questions
Why does my spreadsheet give a different day count than the calculator?
Almost always the inclusive-exclusive convention, occasionally a time-of-day component hiding in a cell. Subtract pure dates, decide explicitly whether the end date counts, and the two will agree.
Are weeks ever ambiguous like months?
No, a week is exactly seven days everywhere, which makes “in six weeks” the most precise casual time phrase available. The ambiguity returns at “in a month” and never really leaves.
How do leap seconds affect date differences?
For dates, not at all; leap seconds adjust clocks, not calendars. They matter to systems timestamping events to the second, which is a different topic than counting days.
What about time zones in date differences?
Pure date differences ignore them, but “dates” extracted from timestamps inherit them: an event at 2 a.m. UTC is yesterday in New York. When inputs come from timestamps, normalize the time zone first, then take the dates.