Skip to content
Verify InstituteA little more certainty.No account required
Methods and assumptions documented

Days Between Dates Calculator

Count elapsed calendar days or include both dates. Choose how reversed dates are shown, and see the weekdays and the exact counting rule.

Your start & end dates

See the method ↓

Choose dates using the native date picker. Results use YYYY-MM-DD. Gregorian calendar dates from year 0001 to 9999 are supported; no clock time or time zone is assumed.

Loading calculator… If this message remains, reload the page.

Counting rules

Same date: 0 elapsed days or 1 inclusive date. Reversed inclusive ranges keep a negative sign unless absolute results are selected.

Calculations run on your device. Input values are not placed in the URL or sent to analytics.

HOW THE CALCULATION WORKS

Subtract calendar ordinals (numbered calendar days), then apply an explicit counting rule

  1. Days before year Y = 365 × (Y−1) + floor((Y−1)/4) − floor((Y−1)/100) + floor((Y−1)/400). Add the lengths of earlier months and the day of month; 0001-01-01 has ordinal (numbered calendar day) 1. Here floor means round down to a whole number. Weekday index = the remainder after dividing (ordinal−1) by 7, starting with Monday at index 0.
  2. Elapsed difference = end ordinal − start ordinal. Same date gives zero.
  3. Inclusive count = sign of date ordering × (absolute elapsed gap + 1); equal dates count one. Signed mode keeps the ordering sign; absolute mode removes it.
  4. Full weeks and extra days describe the unsigned ELAPSED gap: floor(gap/7) weeks and gap modulo 7 days. They never use the inclusive count.

Worked example

From 2024-02-28 (Wednesday) to 2024-03-01 (Friday), the elapsed gap is 2 days. Counting both endpoint dates gives 3 dates: February 28, February 29 and March 1. Swapping the dates gives −2 elapsed or −3 inclusive in signed mode.

Defaults and assumptions

Limitations

Precision and rounding

All calculations use exact bounded integers. Date ordinals (numbered calendar days) run from 1 to 3,652,059; the largest elapsed gap is 3,652,058 days. No rounding, milliseconds, timestamp conversion or local-time parsing enters the calculation. The review record creation timestamp is metadata only.

Sources

Use the assumptions, worked example and sources to interpret your result. Estimates do not replace professional advice.

How to use this calculator

  1. Choose a start and end date using the date pickers. Results use YYYY-MM-DD to avoid ambiguity.
  2. Choose elapsed or inclusive counting, then signed or absolute results for reversed dates. Swap dates if needed.
  3. Calculate and inspect the selected count, ordering and separate elapsed gap. Read the assumptions before using the count for a consequential deadline.

Common questions

Does the end date count?

Elapsed mode subtracts the dates: adjacent dates differ by one. Inclusive mode counts both endpoint dates, so adjacent dates count two and the same date counts one.

What happens if the end date is earlier?

Signed mode gives a negative count for reversed dates. Absolute mode shows its magnitude. The original dates and ordering remain visible.

Does daylight saving change this result?

No. This is calendar-date arithmetic with no clock time or time zone. It does not claim that every calendar day represents exactly 24 elapsed hours.

Report a problem or suggest a calculator

Found a confusing result, a missing option, or an idea for a new calculator? Send it privately to the site owner.

Opening the form loads Cloudflare Turnstile, a spam check that processes connection and device information. Privacy details.

Related tools