How to Calculate Days Between Dates, With or Without the End Date
Learn how to calculate days between dates by hand, whether to count the end date, how leap years and month ends behave, and how weekdays are counted.
By TheTextKit TeamPublished

A table of four counts for the span from 1 January 2026 to 31 December 2026. The end date not counted gives 364 days. Counting the end date gives 365 days. In weeks it is 52 weeks. There are 260 weekdays from Monday to Friday.
To find the days between dates, subtract the earlier date from the later one. From 1 October to 8 October is 7 days, because that counts the days that pass, not the end date itself. If you also need to count the first and last day, add one and the answer is 8. That single choice, whether to include the end date, causes most of the disagreements about date counts. This guide shows the exact method by hand, explains leap years and the odd behavior of month ends, counts weekdays, and reports a test of our calculator against Python on 30,000 pairs of dates.
How to calculate the days between dates
- Open the Days Between Dates Calculator.
- Pick the start date and the end date.
- Read the days. Tick the box to count the end date too.
- Use the other lines for weeks, years, months and days, and the weekdays from Monday to Friday.
The calculator counts whole calendar days, so a daylight saving change cannot add or remove an hour from the result. If the end date is before the start date, it counts from the earlier to the later date and says so.
The method by hand
The easiest way to count days by hand is to turn each date into its number within the year, then subtract. Add up the days in the months before it, and add the day of the month. For a normal year the months run 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31.
Take 15 March to 4 July 2026:
- 15 March is day 31 + 28 + 15 = 74 of the year.
- 4 July is day 31 + 28 + 31 + 30 + 31 + 30 + 4 = 185 of the year.
- Subtract. 185 − 74 = 111 days.
The calculator gives 111 for the same pair. For dates in different years, work in three parts. Add the days left in the first year, which is 365 or 366 minus its day number. Add the day number in the last year. Then add 365 or 366 for each whole year between.
Take 20 December 2025 to 10 January 2026. The days left in 2025 are 365 − 354 = 11, because 20 December is day 354. Add 10 for the day number in 2026 and the span is 21 days. The calculator agrees.
Inclusive or exclusive: should the end date count?
There are two honest answers, and both are used. Subtracting gives the days that pass from the start to the end. The end date is not counted. Counting both ends, as when you count the days of a hotel stay or a course, gives one more.
| Pair | Days that pass | Counting both dates |
|---|---|---|
| 1 October to 8 October 2026 | 7 | 8 |
| 1 January to 31 December 2026 | 364 | 365 |
| 28 February to 1 March 2024 | 2 | 3 |

A table comparing two ways of counting from 1 October to 8 October 2026. With the end date not counted, it is 7 days and 5 weekdays. With the end date counted, it is 8 days and 6 weekdays.
Spreadsheets take the first view. Microsoft's DAYS function subtracts the start date from the end date, and its own example gives 364 for 1 January to 31 December 2021, the same as our 2026 result. Python does the same: the datetime module gives a difference in whole days when you subtract one date from another.
The rule to follow is the one in your agreement. Contract wording differs, and legal deadlines can have their own rules for the first and last day, so read the exact wording. The calculator shows both counts so you can pick the one that matches.
Nights or days?
The same idea explains a common mix-up. A stay from the 1st to the 4th of a month is 3 nights, which is the days that pass. The calendar days it touches are 4, which counts both ends. Both are right, so be clear about which one a form is asking for. If your dates come from logs or APIs as Unix timestamps, our guide to converting a Unix timestamp to a date shows how to turn them into calendar dates first.
Leap years change the count
A year has 366 days if it is divisible by 4, except for century years, which must also be divisible by 400. So 2024 and 2000 are leap years, and 1900 and 2100 are not. Python's documentation describes its calendar as the Gregorian calendar extended indefinitely in both directions, which is the model the calculator uses.
| Span | Days |
|---|---|
| 28 February to 1 March, 2024 | 2 |
| 28 February to 1 March, 2026 | 1 |
| 1 January 2024 to 1 January 2025 | 366 |
| 1 January 2026 to 1 January 2027 | 365 |

A table of four spans comparing a leap year with a normal year. 28 February to 1 March is 2 days in 2024 and 1 day in 2026. A full year from 1 January is 366 days in 2024 and 365 days in 2026.
Weeks, months and the 31 January problem
Days convert to weeks by dividing by 7: 364 days is exactly 52 weeks. Months are harder, because they have different lengths, so there is no fixed number of days in a month. The calculator counts a month from the same day number. The dateutil library documents the same rule. When the result falls on a day that does not exist, the last day of the month is used, so adding one month to 31 January 2003 gives 28 February 2003.
That has a surprising effect on spans that start at a month end:
| From 31 January 2026 to | Years, months and days |
|---|---|
| 27 February | 0 months, 27 days |
| 28 February | 1 month, 0 days |
| 1 March | 1 month, 1 day |

A table of three spans starting on 31 January 2026. To 27 February it is 0 months and 27 days. To 28 February it is 1 month and 0 days. To 1 March it is 1 month and 1 day.
Going from 27 to 28 February adds one day but turns 27 days into a full month. It is not a bug. It follows from the rule that 31 January plus one month is 28 February. If a different convention matters to you, count in days.
Counting business days
The weekday count is Monday to Friday. The method is quick: five for every full week, plus the weekdays among the leftover days. From 12 October to 27 November 2026 is 46 days, which is 6 full weeks and 4 leftover days. Six weeks give 30 weekdays, and the leftover days (Monday to Thursday) add 4, so the end date is not counted: 34. Counting the end date, a Friday, adds one more: 35.
The calculator does not remove public holidays or other days off, since they depend on the country and the year. Subtract your own holidays that fall on a weekday. For a whole year, 1 January 2026 to 1 January 2027 has 261 weekdays, and counting the final Friday gives 262.
How we tested it
We compared the calculator with Python's own tools. A script made 30,000 pairs of dates from 1850 to 2150, including month ends, 28 and 29 February, and leap and century years. For each pair, Python's datetime gave the days and weekdays, dateutil gave the years, months and days, and numpy counted the weekdays. We compared everything with our calculator.
| Check | Matched |
|---|---|
| Days between | 30,000 of 30,000 |
| Years, months and days | 30,000 of 30,000 |
| Weekdays, end date not counted | 30,000 of 30,000 |
| Weekdays, end date counted | 30,000 of 30,000 |
| Name of the weekday | 30,000 of 30,000 |

A table of five checks of the days between dates calculator against Python on 30,000 date pairs. The days, the years months and days, the weekday count with and without the end date, and the weekday names all matched in 30,000 of 30,000 cases.
The test checks the arithmetic against the Gregorian calendar. It cannot tell you which counting rule your contract uses, and it does not know about holidays or about calendars other than the Gregorian one.
Frequently asked questions
How do I calculate the number of days between two dates?
Subtract the earlier date from the later one. From 1 October to 8 October is 7 days. That counts the days that pass, not the end date itself. If you also need to count the first and last day, add one, which gives 8.
Should the end date be included?
It depends on what you are counting. The days that pass between two dates leave out the end date, and that is how spreadsheet DAYS functions work. Counting both the first and last day, for a booking or a stay, adds one. Check the rule that applies to your contract or form.
How are business days counted?
Business days here means Monday to Friday. The count is five for every full week plus the weekdays in the remaining days. Public holidays are not removed, because they differ by country and year, so subtract them yourself.
Why is 31 January to 28 February one month?
Because adding one month to 31 January gives the last day of February, which is 28 February in a normal year. So the whole span is one month and zero days. From 31 January to 27 February it is zero months and 27 days.
Is my data uploaded?
No. The calculation runs in your browser, and the dates you pick are not sent anywhere or stored. The tool needs no account and keeps nothing after you close the page.
Count the days now
Open the Days Between Dates Calculator, pick two dates, and read the days, weeks, months and weekdays. To work out someone's age, use the Age Calculator. Everything runs in your browser, so nothing is uploaded.


