Toolyard

How to Calculate the Number of Days Between Two Dates

Online

Pick the two dates in Days Between Dates. It shows the total days, weeks and days, years, months and days, and weekdays (Monday to Friday). Tick Include end date if both the first and last day should count, as for a hotel stay counted in days rather than nights.

In Excel or Google Sheets

With the start date in A1 and the end date in B1:

  • Days: =B1-A1 (format the cell as a number, not a date).
  • Weekdays, counting both ends: =NETWORKDAYS(A1,B1). Add a range of holiday dates as a third argument to skip them too.
  • Whole months or years: =DATEDIF(A1,B1,"m") or =DATEDIF(A1,B1,"y").

Counting forwards instead

To find the date 90 days or 30 business days from today, use Add or Subtract Days. In a spreadsheet, =A1+90 adds calendar days and =WORKDAY(A1,30) adds working days.

Common mistakes

  • Off by one: from Monday to Friday is 4 days apart but 5 days if you count both.
  • Months are not all the same length: "one month" from 31 January lands on the last day of February.

A worked example

From January 15 to March 1, 2026:

  • January 15 to February 15 is 31 days, because January has 31.
  • February 15 to March 1 is 14 days, because February 2026 has 28.
  • Total: 45 days, or 46 if both January 15 and March 1 count.

In 2028, a leap year, the same dates are 46 days apart, because February has 29 days.

In code

Subtracting two timestamps and dividing by 86,400,000 milliseconds can give 44.96 instead of 45, because a day that changes to or from daylight saving time is 23 or 25 hours long. Round the result, or count calendar dates rather than hours.

Tools in this guide

More guides