Skip to main content

How to Calculate the Difference Between Two Dates (Days, Months, Years)

MyCalculatorHQ Editorial Team

Editorial Team

Updated Jun 18, 2026 5 min read
How to Calculate the Difference Between Two Dates (Days, Months, Years)

How many days between January 15 and August 22? How many months and days since your wedding? How long until your lease expires?

Date difference calculations seem simple but months have different lengths, leap years exist, and the results depend on whether you count the start date, end date, or both. Here's how to do it right.

Calculating Days Between Two Dates

The most precise way to express a date difference is in total days. Every day is exactly 24 hours — no ambiguity.

Method: Convert both dates to a day number, then subtract.

Example: January 15, 2026 to August 22, 2026

  • January 15 = day 15 of the year
  • August 22 = day 234 of the year
  • Difference: 234 - 15 = 219 days

When dates span multiple years, add 365 (or 366 for leap years) for each full year crossed.

Calculating Months and Days

Breaking the difference into months and days is more intuitive but less precise — because months have different lengths.

Step 1: Count complete calendar months between the dates.

Step 2: Count remaining days in the partial month.

Example: March 10 to July 25

  • Complete months: April, May, June, July = 4 months... wait
  • Actually: March 10 to July 10 = 4 complete months
  • Remaining: July 10 to July 25 = 15 days
  • Result: 4 months and 15 days

Inclusive vs. Exclusive Counting

Should you count the start date? The end date? Both?

From January 1 to January 3:

  • Exclusive (neither counted): 2 days
  • Inclusive of end only: 3 days (Jan 1, 2, 3)
  • Inclusive of both: technically 3 days between them

Most date calculators use exclusive counting — not counting either endpoint. Legal and financial contexts sometimes specify inclusive counting. When precision matters, clarify which method applies.

Leap Year Considerations

February 29 only exists in leap years. When calculating across February in different years:

  • February 2024 has 29 days (leap year)
  • February 2025 has 28 days (not a leap year)
  • February 2026 has 28 days (not a leap year)

This matters for annual calculations. One year from February 15, 2024 to February 15, 2025 = 365 days. One year from February 15, 2023 to February 15, 2024 = 366 days (crosses the leap year).

Common Date Difference Use Cases

  • Contract duration: Start date to end date in days or months
  • Age calculation: Birthdate to today
  • Deadline tracking: Today to due date
  • Anniversaries: Original date to today in years and days
  • Payment terms: Invoice date to payment due date
  • Project timelines: Start to completion in working days

Calculate the exact difference between any two dates with our Date Difference Calculator.

Common Questions

Frequently Asked Questions

Written by

MyCalculatorHQ Editorial Team

Expert team building accurate, easy-to-use calculators and educational content for finance, health, and academics. Our tools are reviewed by industry professionals to ensure accuracy and reliability.

Get calculator tips

Weekly guides. No spam. Free forever.