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.
HOW THE CALCULATION WORKS
Subtract calendar ordinals (numbered calendar days), then apply an explicit counting rule
- 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.
- Elapsed difference = end ordinal − start ordinal. Same date gives zero.
- Inclusive count = sign of date ordering × (absolute elapsed gap + 1); equal dates count one. Signed mode keeps the ordering sign; absolute mode removes it.
- 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
- Dates are blank initially; no current date or time zone is assumed. Supported dates are 0001-01-01 through 9999-12-31. Results and review records use YYYY-MM-DD, although a native picker may display your browser’s local date format.
- Gregorian rules are extended backward before their historical adoption. Leap years are divisible by 4, except centuries not divisible by 400. Impossible dates are rejected, not rolled into another month.
- Elapsed counting and signed reversed-date results are selected. A reversed inclusive range is negative: 2024-03-01 to 2024-02-28 gives −3; absolute mode gives 3.
Limitations
- Calendar dates only: no time of day, daylight-saving adjustment, elapsed-hour claim, holidays, business days or historical calendar-adoption correction. A calendar day is not necessarily a 24-hour elapsed interval.
- This tool does not establish legal, contractual or filing-deadline counting rules. Choose the convention that matches your task and independently check consequential deadlines.
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
- U.S. Naval Observatory · Leap years and the Gregorian calendar ↗
- HTML Standard · Calendar date syntax ↗
Use the assumptions, worked example and sources to interpret your result. Estimates do not replace professional advice.
How to use this calculator
- Choose a start and end date using the date pickers. Results use YYYY-MM-DD to avoid ambiguity.
- Choose elapsed or inclusive counting, then signed or absolute results for reversed dates. Swap dates if needed.
- 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.