Guides/Date difference
How to calculate days between two dates
Counting days between dates shows up in project deadlines, travel planning, warranties, and event countdowns. Calendar math is trickier than it looks because months have different lengths and leap years exist.
The reliable approach
Convert each calendar date to a fixed reference (for example UTC midnight for that year-month-day), then subtract and divide by 86,400,000 milliseconds (one day). That avoids most timezone “off-by-one” bugs that happen when you use local midnight near DST changes.
- Days = whole-day difference (same date → 0)
- Weeks = days ÷ 7
- Months (approx.) = days ÷ 30.4375 (average Gregorian month length)
Worked examples
- Same month: 2026-03-01 → 2026-03-31 = 30 days(end − start; the end date is not “inclusive” as a +1 unless you choose that convention).
- Across months: 2026-01-15 → 2026-02-15 = 31 daysin a non-leap February span from mid-Jan.
- Add N days: start 2026-10-31 + 30 days → 2026-11-30.
- Two weeks: 2026-01-01 → 2026-01-15 = 14 days = 2.00 weeks.
- Leap day: 2024-02-28 → 2024-03-01 = 2 days(2024 is a leap year, so Feb 29 exists).
Inclusive vs exclusive counting
If someone says “how many days does the trip last from Friday to Sunday?”, they may mean 3 calendar days (inclusive) even though Sunday − Friday = 2. Always clarify whether both endpoints count. Our calculator reports the signed day difference (end − start). For countdowns and business-day estimates, seehow many days until a date.
Common mistakes
- Forgetting leap years when spanning late February.
- Using “months = days ÷ 30” for legal or billing periods that need exact calendar months.
- Mixing local midnight with UTC near daylight-saving transitions.
When to use which tool
- Date Difference Calculator — days between, or add N days.
- Days until / business days — countdowns and weekday estimates.
Use the free calculator
Try theDate Difference Calculatorto compare two dates or add N days. Private, client-side only.
Related:Days until a date·Unit Converter·Unit conversion guide