PRACTICAL GUIDE

Count Days Between Two Dates Without an Off-by-One Error

Decide whether the final date counts before comparing a duration, trip or leave request.

Duration and covered dates are different

January 1 to January 2 is one elapsed calendar day. A stay or attendance record covering both named dates may instead need a count of two dates. Neither convention fits every task. Decide what you are counting, then use the end-date option that matches the rule.

A short worked example

From January 5 to January 12, 2026, the ordinary difference is seven days, or one full week. Including January 12 changes the covered-date count to eight. Write the convention beside your answer when another person will use it; otherwise the same inputs can appear to give conflicting results.

Months cannot be replaced by thirty days

Calendar months have different lengths. A years/months/days result uses completed calendar units, while total days measures the entire interval independently. January 31 to February 28 can be one completed month under month-end clamping while still containing 28 elapsed days. Use total days when every day has equal weight.

Choose another tool when necessary

For a Monday–Friday project schedule, use business days and add the actual excluded holiday dates. For an event starting at 15:00, a date-only difference leaves out the hours. Use a dated time conversion if the beginning and end are in different time zones.

Put it into practice