Counting days between two dates seems simple, but the months have different lengths, years sometimes have a leap day, and it is not always clear whether to include the first and last day. This guide shows how to get a reliable answer.
Decide how to count first
The first question is whether to include both end dates. If you are asked how many days from October 15 to October 16, the answer is normally 1, because one day passes. If you are asked how many days a conference lasts from October 15 to October 16, the answer is 2, because both days are included.
The usual rule for date differences is to count the nights, or the steps from one date to the next, so the start date is not included. If you need both included, add one.
The month-by-month method
For dates in the same year, count the days that remain in the first month, then add whole months, and finally the days in the last month. For example, from October 15 to December 24, 2026:
- Rest of October: 31 − 15 = 16 days
- All of November: 30 days
- December 1 to December 24: 24 days
That gives 16 + 30 + 24 = 70 days. You need to remember the lengths of the months: 31 days in January, March, May, July, August, October and December, 30 in April, June, September and November, and 28 or 29 in February.
The day-of-year method
Another way is to give each date a number from 1 to 365 (or 366), the day of the year, and subtract. October 15 is day 288 in an ordinary year, or 289 in a leap year, and December 24 is day 358 or 359. The difference is 70 either way, because the leap day is before both dates.
For dates in different years, add the number of days in the whole years in between, and remember that a year has 366 days if it is a leap year.
Across years and leap days
From January 1, 2026 to January 1, 2027 is 365 days, but from January 1, 2027 to January 1, 2028 is also 365, and from January 1, 2028 to January 1, 2029 is 366, because 2028 includes February 29. Over any four-year period the total is usually 1,461 days.
A useful check is that 400 years contain exactly 146,097 days, which is exactly 20,871 weeks, so the weekday pattern of the calendar repeats every 400 years.
How computers do it
Computers do not use months at all. They convert each date to a single day number, such as the number of days since January 1, 1970, or a spreadsheet serial number, and then simply subtract. The conversion handles the month lengths and leap years once, and everything after that is arithmetic.
Programmers need to watch for daylight saving time when they subtract timestamps instead of dates. A day with a clock change has 23 or 25 hours, so a difference of 24 hours is not always one calendar day.
Business days and weeks
To count weeks, divide the number of days by seven. To count working days, count the weekdays, which means subtracting two days for each full week and then adjusting for any partial week. Public holidays that fall on a weekday must also be subtracted, as described in the guide to Norwegian public holidays.
For example, from Monday, October 5 to Friday, October 16, 2026 there are 11 days between the dates and exactly 10 working days, two full working weeks.
A worked example across several years
How many days is it from October 15, 2026 to October 15, 2030? There are four whole years, and the period contains one leap day, February 29, 2028. The result is 4 × 365 + 1 = 1,461 days. Divided by 7 that is 208 weeks and 5 days, so if the first date is a Thursday, the last date is a Tuesday. The check works because every ordinary year shifts the weekday by one and every leap year by two.
Common mistakes
- Forgetting to include or exclude the end day consistently.
- Assuming every month has 30 days. This introduces an error of a few days over a year.
- Missing the leap day when the period contains February 29.
- Mixing up the date formats. 04/05/2026 is April 5 in the United States and May 4 in most of Europe.
Use the tool
The days-between-dates tool on this site does the counting for you, handles leap years correctly and can show the result in days, weeks, months and years. The date-add tool does the reverse: it gives the date that is a given number of days before or after a start date.