Developer

How to Calculate Days Between Dates Without Off-by-One Errors

Separate elapsed time from inclusive calendar counting when measuring date ranges.

Related tool

Date Difference Calculator helps you apply this guide directly in the browser.

Open tool

Elapsed days and inclusive days differ

The elapsed difference from Monday to Tuesday is one day. A schedule that counts both Monday and Tuesday as active dates may describe the same range as two calendar days.

State which interpretation you need before using a result in billing, deadlines or reports.

Calendar months are not equal lengths

A month can contain 28, 29, 30 or 31 days. That is why a year-month-day breakdown is different from dividing total days by a fixed number.

Use total days for exact elapsed duration and calendar units when the human calendar relationship matters.