CALCSHQ

Time & Date

Days between dates calculator

Pick two dates — see the exact number of days between them, plus weeks, months, years, hours, minutes, and seconds.

Total days
0
Weeks
0.00
Months
0.00
Years
0.000
Hours
0
Minutes
0
Seconds
0

Formula

Dates are converted to UTC milliseconds, subtracted, then divided by milliseconds per day.

Computing exact day counts between two dates is harder than it looks: months have different lengths, leap years add a day every four years (with the century rule), and timezone changes can shift midnight. This calculator sidesteps the complexity by working in UTC milliseconds — subtract the two timestamps, divide by 86,400,000, and round.

The higher-unit conversions (weeks, months, years) use average lengths: 7 days per week (exact), 30.4375 days per month (365.25 / 12), 365.25 days per year (Gregorian calendar average accounting for leap years). They're approximations — actual calendar months and years vary. For exact calendar arithmetic (X years and Y months and Z days), use the age calculator instead.

Negative results mean the 'to' date is before the 'from' date. The total counts as a signed integer.

Examples

  1. 01From 2024-01-01 to 2025-01-01
    366 days (2024 is a leap year)
  2. 02From today to next New Year
    Varies — try it
  3. 03From 1969-07-20 (moon landing) to 2024-07-20
    20,089 days = 55 years

FAQ

  • Months don't have a fixed length (Feb is 28-29, others 30-31), so the calculator divides total days by 30.4375 (the average across a 4-year cycle). It's accurate as a duration measure but not a calendar count. For calendar-correct '5 months and 3 days', use the age calculator with the two dates as DoB and 'as of'.

References

Reviewed by
Last updated
May 27, 2026
Formula source
Privacy
All math runs in your browser. No values are sent to any server.

Note: Results are accurate to floating-point precision (~15 significant digits) for the standard formula shown above. See our terms of use for general usage information.

Related calculators