How to Work Out the Days Between Two Dates
Counting the days between two dates sounds trivial and is the sort of calculation people get wrong confidently. The Date Difference Calculator handles it, including the awkward parts.
Inclusive or exclusive, and why it matters
The first question is whether both end dates count. From the 1st to the 10th is nine days if you subtract, ten if you count both days on the calendar.
Neither is wrong; they answer different questions. "How many days until" is exclusive - subtract. "How many days am I staying" or "how many days does this cover" is usually inclusive - subtract and add one.
This is where notice periods, hire charges and deadlines go wrong, and it is worth stating which convention you are using when the answer matters to someone else. A contract saying "within 30 days" is ambiguous enough that courts have had to settle it.
Leap years, including the rule people miss
A leap year is every four years, except years divisible by 100, except years divisible by 400. So 1900 was not a leap year and 2000 was.
That third clause is the one that gets dropped, and it is why some older software mishandled 1900 - a bug Excel still carries deliberately, for compatibility with a 1980s spreadsheet that had it.
For any span crossing a February, the count depends on whether that year was a leap year. Which is why you cannot reliably do date arithmetic by multiplying - the honest method is to convert both dates to a day count and subtract, which is what a calculator does and what the Unix Timestamp Converter does with seconds.
Working days are a different question
"Thirty days" and "thirty working days" are six weeks apart.
Working days exclude weekends, which is straightforward, and public holidays, which are not - they differ by country, by region within a country, and by year, since several move with Easter or fall to the nearest Monday.
So a working-day calculation is only as good as its holiday list, and a general calculator cannot know yours. For anything contractual, count against the actual calendar of the jurisdiction involved.
Months and years are not units
A month is 28 to 31 days and a year is 365 or 366, so "three months" is anywhere from 89 to 92 days.
Which means there are two different correct answers to "how long between these dates": a count of days, which is exact, and a span in years, months and days, which depends on a borrowing convention at month ends. Both are useful; they are not interchangeable, and the Age Calculator covers the second.
Common questions
How many days until a date next year?
Convert both to day counts and subtract. Do not multiply months by 30.
How many weeks between two dates?
Divide the days by seven. The remainder is the odd days, which usually matter.
Why does my spreadsheet give a different answer?
Almost always the inclusive-or-exclusive question, or a date read as American when it was written European.
How do I count age in years?
Whole years first, then months, then days - a different calculation from a day count.
Got two dates to measure?