Skip to main content
SwiftTools

How to Calculate the Number of Days Between Two Dates

Counting days between two dates is the kind of thing that seems impossible to get wrong - until a project deadline, a loan term or a delivery SLA comes out one day off, and everyone argues about it. The errors are not arithmetic; they are convention: whether the end dates count, and which calendar counts.

This guide separates the three decisions that actually drive the answer - endpoint counting, calendar type, and date hygiene - and gives a check you can run in ten seconds.

Inclusive vs exclusive: the off-by-one that haunts everything

The gap between Monday and Wednesday is two days (Mon to Tue, Tue to Wed - the clock answer) or three days (Mon, Tue, Wed - the "three-day stay" answer). Both are correct; they answer different questions, and mixing them up is the single most common date error.

The convention to adopt: name it. "From Monday to Wednesday inclusive" means 3; "the difference" or "the gap" usually means 2. When a contract, SLA or form gives a day count, find which convention it uses - legal periods frequently include the start date, while delivery estimates frequently do not.

Two conventions, one pair of dates
From: Mon 3 Aug 2026   To: Wed 5 Aug 2026
Exclusive (gap):      5 - 3  = 2 days
Inclusive (both ends): 5 - 3 + 1 = 3 days

Calendar days, business days, working days

The second decision is which days count at all. Three calendars:

  • Calendar days: every day counts. Use for durations, ages, warranties and anything casual.
  • Business days: Monday-Friday count; weekends do not. The default for delivery, processing and most SLAs.
  • Working days with holidays: business days minus public holidays for a named country or region. The only correct calendar for legal deadlines and payment settlement - and the reason "10 business days" differs by a week between two countries around a holiday cluster.

State the calendar in every answer you give: "9 calendar days (6 business days)" removes the argument before it starts.

Date hygiene: the mistakes that are not math

Most "wrong" day counts are input problems, not computation problems:

  • Timezones sneaking in: comparing a 23:59 timestamp in one zone with a 00:01 timestamp in another can flip the day. Compare calendar dates (day-level), not timestamps, unless you specifically need sub-day precision.
  • Month-length traps: "add one month" from 31 January lands on 28/29 February in most conventions, not 31. Duration tools handle it; mental math does not.
  • Year-end wrap: spans crossing a year boundary are where off-by-ten and off-by-one both live. Verify against a midpoint you know (a January date in the middle of the span).
  • Daylight saving: DST changes do not alter calendar dates, but they do alter 24-hour spans - a "day" across a spring-forward is 23 hours. Irrelevant for date counting, relevant for duration math.

A ten-second sanity check

Before you trust any day count, run the check: convert the span into months or weeks (divide by 30 or 7) and confirm the order of magnitude is plausible. A "gap" that came out as 1,800 days for what should be a six-month project is not an arithmetic result you should argue about - it is a unit error (minutes, maybe) or a wrong endpoint. Plausibility beats precision: the answer should look right before it needs to be exact.

Frequently asked questions

Does the count include the end dates?

It depends on the convention you choose: exclusive counts the gap (Mon to Wed = 2), inclusive counts both endpoints (= 3). Pick deliberately and say which you used.

How do business days work around holidays?

Weekends never count; public holidays for the relevant country or region are also excluded when a holiday calendar is applied. The holiday set is what makes "10 business days" country-specific.

Why does my count come out one day different from a friend's?

Almost always an endpoint convention: one of you counted inclusively, the other exclusively. The arithmetic is identical; the definition is not. Agree the definition, and the numbers agree.

Can I calculate the difference in weeks or months instead?

Yes - most tools report years/months/days or a total day count, from which weeks (divide by 7) follow. Months are tricky as a unit (28-31 days), so calendar months are counted, not divided.

Want to try it?

The Date Difference Calculator is free and runs right in your browser (date & time). Open it now and see the guide in action.

Try the Date Difference Calculator