Skip to main content
DATE & DURATION

Date Difference Calculator

Enter a start and end date to get the difference in years, months, weeks and days, plus the totals in each unit.

Start date and time
End date and time

Calendar difference between two dates

This calculator breaks the gap between two dates into whole years, whole months, whole weeks and remaining days, the way people naturally describe an age or a countdown: for example 1 year, 3 months and 2 days rather than an unwieldy number of days. It also gives you the same gap as a single total in days, hours, minutes and seconds.

Leap years are handled automatically. A February that has 29 days is simply one day longer, so a difference that spans it comes out correctly without any extra input from you.

How the year and month count is chosen

Whole months are counted first, using the calendar (so January 31 to February 28 is treated as one full month), and any partial month left over is expressed in weeks and days. This matches how people read a date range on a calendar, rather than converting everything to an average month length.

Want the background? Read our comprehensive guide: Time Zones and DST for Developers.

How to use this tool

  1. Enter the start date, or select Use today.
  2. Enter the end date.
  3. Select Calculate difference.
  4. Read the breakdown in years, months, weeks and days, and the totals below it.

Examples

A leap-year crossing and a longer, multi-month gap.

Across a leap day

2024-02-28 to 2024-03-01

Difference
2 days
Total days
2

Nine and a half months

2026-09-01 to 2027-06-15

Difference
9 months 2 weeks
Total weeks
41

The same date, twice

2026-09-21 to 2026-09-21

Difference
0 seconds

Frequently Asked Questions

How many days are between two dates?
Enter both dates and read the Total days figure, which is the exact number of calendar days between them, leap years included.
Does it matter which date I enter first?
No. If the end date is earlier than the start date, the calculator swaps them automatically and says so, so the breakdown is always a positive duration.
How are leap years handled?
A leap year's extra day (29 February) is simply counted like any other day, so a range that includes it is one day longer than the same range in a non-leap year.
Why do the years and months look different from just dividing the days?
Months have different lengths (28 to 31 days) and years vary between 365 and 366 days, so the calculator counts whole calendar months and years directly instead of dividing by an average length, which would be less precise.