Date Difference Calculator

Find the exact number of days, weeks, months, and years between any two dates. Handles leap years automatically.

Calculate

Defaults to today
Time between dates
Total days
Total weeks
Months and days
Total hours
Total minutes
Ad

Why Calculating Exact Days Between Dates Is Harder Than It Looks

On the surface, subtracting two dates seems straightforward. In practice, it requires accounting for months with different lengths (28, 29, 30, or 31 days), leap years (an extra day in February every 4 years, with exceptions for century years), and time zones for precise calculations. This calculator handles all of these automatically — just enter the two dates.

How Date Difference Is Calculated

The simplest approach converts both dates to a total day count from a fixed reference point (typically January 1, year 1 of the proleptic Gregorian calendar), then subtracts. The JavaScript Date object does this internally using Unix timestamps (milliseconds since January 1, 1970). Dividing the millisecond difference by 86,400,000 gives exact days, accounting for all leap years automatically.

Example: From January 1, 2020 to July 7, 2026: this spans 6 years, 6 months, and 6 days. It includes leap years 2020 and 2024 (each contributing an extra day). Total = 2,378 days, or 339 weeks and 5 days.

Common Uses for Date Difference Calculations

Use CaseWhat You're CalculatingWhy It Matters
Age calculationDays from birth to todayPrecise age for medical, legal, or fun purposes
Project deadlineDays from start to due datePlanning sprints, milestones, and buffers
Lease / contract durationDays from signing to expiryVerifying notice periods and renewal windows
Event countdownDays until a wedding, exam, or holidayPacing preparation and anticipation
Loan term verificationDays between first and final paymentConfirming actual vs stated term
Investment holding periodDays between buy and sell dateTax purposes — short-term vs long-term capital gains
Statutory notice periodDays from notice to effective dateEmployment law compliance

Leap Year Rules — The Full Picture

Leap year rules are more complex than "every 4 years":

  • A year is a leap year if it is divisible by 4
  • Exception: years divisible by 100 are NOT leap years
  • Exception to the exception: years divisible by 400 ARE leap years

So: 2000 = leap year (÷400). 1900 = NOT a leap year (÷100 but not ÷400). 2024 = leap year (÷4). 2100 = NOT a leap year (÷100 but not ÷400). This is why the Gregorian calendar has 97 leap years every 400 years — giving an average year length of 365.2425 days, very close to the actual solar year of 365.2422 days.

Business Days vs Calendar Days

Many legal and business calculations require business days (working days, excluding weekends) rather than calendar days. A 30-calendar-day period contains approximately 21 business days. A 90-calendar-day period contains approximately 64 business days.

For employment notice periods, invoice payment terms (Net 30, Net 60), court deadlines, and delivery promises — always clarify whether "days" means calendar or business days. This calculator counts calendar days. For business day calculations, note that each calendar week has 5 business days, so divide calendar days by 7 × 5 for an approximation, then adjust for any holidays in the period.

Time Zones and Date Boundaries

When calculating days between dates in different time zones, exact timing matters. An event at 11 PM Eastern (UTC−5) occurs at 4 AM UTC the next day — a different calendar date in some contexts. For purely date-based calculations (whole days without time), this calculator uses midnight-to-midnight boundaries regardless of time zone, which is appropriate for most everyday purposes.

Frequently Asked Questions

Is January 1 to January 31 a difference of 30 or 31 days?

30 days. The difference is counted as the number of complete days between the two dates. January 1 to January 2 = 1 day (one day has elapsed). January 1 to January 31 = 30 days. If you need to count the start and end dates both as full days (inclusive), add 1 to the result (30 + 1 = 31 days inclusive).

How many days are between two dates in the same month?

Subtract the smaller day number from the larger. March 8 to March 25 = 17 days. This works within any single month. For dates in different months, use this calculator for accuracy, since months have different lengths.

How do I calculate the number of weeks between two dates?

Divide the total number of days by 7. The calculator shows both the total weeks and the remaining days. For example: 100 days = 14 weeks and 2 days. This is useful for pregnancy tracking, training plans, or project sprints measured in weeks.

What is the difference between a Julian date and a Gregorian date?

The Julian calendar (used before 1582) adds a leap year every 4 years without exceptions. The Gregorian calendar (current system) adds the century year correction. The two calendars have drifted 13 days apart — dates before October 1582 may be labelled OS (Old Style) or NS (New Style) in historical documents. This calculator uses the proleptic Gregorian calendar for all dates.

How many days until Christmas, New Year, or other holidays?

Enter today's date in the start field and the holiday date in the end field. For recurring annual events, enter the next upcoming date. This is one of the most popular uses of date difference calculators — event countdowns for holidays, birthdays, and anniversaries.

What is the Unix timestamp and why does it matter?

The Unix timestamp is the number of seconds since January 1, 1970 (UTC), used internally by computers to store dates and times. It is the basis for all date arithmetic in programming. Converting two Unix timestamps to dates and subtracting gives exact elapsed time. On January 19, 2038, the Unix timestamp will overflow a 32-bit integer — a potential "Y2K38" problem for older systems.

Ad