Date Duration Calculator: Quick, Simple, and Handy

How the calculation works

The script takes the millisecond difference between the two dates (endDate - startDate), divides by 86,400,000 (the number of milliseconds in a day), and floors the result to get whole days. Worked example: from 2026-01-01 to 2026-03-15 is 73 days total. Since that's over 30, the tool also breaks it down: years = Math.floor(days / 365), months = Math.floor((days % 365) / 30), giving 0 years, 2 months, 13 remaining days — displayed as "2 months 13 days (73 days total)".

A rounding caveat worth knowing

The month/year breakdown uses fixed divisors — 365 days per year and 30 days per month — rather than calendar-aware month lengths. That means a span crossing February, or a leap year (2028, 2032), will show a slightly different month/day split than a calendar app would give you. The raw day count and the "(X days total)" figure are always exact; treat the years/months breakdown as an approximation.

What counts as "same day"

If start and end date are identical, the result reads "Same day" (0 days). A one-day gap reads "1 day" (singular, no "s"). Anything from 2 to 29 days shows as a plain day count with no year/month conversion, since the 30-day-per-month divisor only kicks in at day 30.

Typical uses

Contract terms (days until a lease or notice period ends), age-in-days calculations, project timelines, or figuring out how many days remain until a deadline — enter today as the start date and the deadline as the end date to get the exact day count.