How Do You Count the Days Between Two Dates?
What Does "Days Between Dates" Actually Mean?
The short answer is subtraction, with a catch. If you subtract the day numbers alone (say, 15 minus 3), you get a wrong answer whenever a month boundary falls between them. A real count has to walk the calendar. That is why the reliable method is to turn each date into a single day number and subtract.
What Is the Formula for Days Between Two Dates?
Convert each date to an ordinal day count: days since a fixed starting point, like January 1 of year 1. Then subtract.
- Day number = (days in all full years before the date) + (days in all full months before the date) + (day of the month)
- Days between = larger day number minus smaller day number
You do not have to build that by hand. Excel's DAYS function, Google Sheets, and most programming languages all do this internally. The free calculator on this page skips the arithmetic entirely.
Worked Example
How many days from March 3 to July 15, same year, non leap year?
| Segment | Days |
|---|---|
| Rest of March (31 minus 3) | 28 |
| April | 30 |
| May | 31 |
| June | 30 |
| July 1 to 15 | 15 |
| Total | 134 |
So March 3 to July 15 is 134 days. That is the exclusive count, meaning it does not include March 3 itself. Add one if you want both endpoints counted.
Do You Count the Start Date or the End Date?
People usually mean one of two things here, and it changes the answer by one day. An exclusive count measures the gap (how many days until the event). An inclusive count includes both endpoints, which is how many people count vacation days or a hotel stay. Decide which you need before you trust the number.
Why Do Leap Years Matter?
Every four years, February gets a 29th day, so any span crossing that date gains one day. The rule is slightly fussier than "every four years": century years like 1900 skip the leap day unless they are divisible by 400. That is why 2000 was a leap year and 2100 will not be. A calculator handles this automatically, which is the main reason to use one.
A Detail Worth Knowing
There are 365 days in a common year and 366 in a leap year, but the average calendar year is about 365.2422 days. That leftover fraction is exactly why the leap year rules exist in the first place.
Do the math: open the days between dates