Date Difference Calculator Online Free

⏰ Date and Time Free Forever

Date Difference Calculator Online Free

Find the exact number of days, weeks, months, and years between any two dates. See it broken down in every unit, with a clear summary you can copy.

Start date
End date
Select start and end dates to calculate the difference
0
days
About This Tool

Two ways to measure the gap between two dates, and why they disagree

Ask how far apart 15 January and 15 March are and you get two defensible answers. Two months. Or 59 days. Both are right. They measure different things, and mixing them up is where date arithmetic quietly goes wrong in contracts, invoices and project plans.

This tool computes both at once, side by side, so you can see the relationship instead of guessing which one your spreadsheet gave you.

Calendar breakdown
1y 2m 5d
Walks the calendar, borrowing real month lengths. This is what a human means by how long ago. Non linear, because months vary from 28 to 31 days.
Absolute total
431 days
Raw millisecond gap divided down. Linear and additive, which is what you want for interest accrual, SLA windows and anything you plan to sum.

The calculation, line by line

The tool normalises both inputs to local midnight, orders them so the earlier date comes first, then runs two independent passes.

// pass one: absolute gap ms = later – earlier totalDays = round(ms / 86400000) weeks = totalDays / 7 hours = ms / 3600000 // pass two: calendar breakdown with borrowing yy = later.year – earlier.year mm = later.month – earlier.month dd = later.day – earlier.day // day 0 of the later month resolves to the // last day of the month before it if (dd < 0) { mm–; dd += daysIn(previousMonth) } if (mm < 0) { yy–; mm += 12 }

Note the round rather than floor on total days. That is deliberate. Daylight saving transitions make some local days 23 or 25 hours long, and flooring would silently drop a day whenever a spring clock change falls inside your range. Rounding absorbs the one hour wobble.

What each output actually counts

OutputHow it is derivedExact
DaysMillisecond gap divided by 86,400,000, roundedYes
WeeksTotal days divided by 7, two decimalsYes
HoursMillisecond gap divided by 3,600,000Yes, in absolute terms
MinutesMillisecond gap divided by 60,000Yes
SecondsMillisecond gap divided by 1,000Yes
MonthsWhole months from the walk, plus leftover days over 30.44Approximate
YearsMillisecond gap over 365.25 days, three decimalsApproximate
Anything marked approximate uses an average month or year length. 30.44 is the mean Gregorian month, calculated as 365.2425 divided by 12. 365.25 is the Julian year, which builds in one leap day every four years. Never use these averages for legal or financial deadlines. Use the calendar breakdown or the exact day count instead.

Inclusive versus exclusive counting

This is the single biggest source of off by one arguments in date maths. From Monday to Friday is four days if you count the gaps, five days if you count the days themselves.

  • Exclusive, what this tool doesCounts the elapsed interval. Start date is day zero. Standard for age, tenure, elapsed time and most software date libraries.
  • Inclusive, add oneCounts both endpoints. Standard for hotel nights billed as days, hire periods, prison sentences and many statutory notice periods. If you need this, add one to the day total.
  • Half open rangesDatabases and most APIs treat ranges as start inclusive, end exclusive. A booking from the 1st to the 4th occupies three nights. This matches the exclusive count exactly.

The leap year counter

The tool scans every year touched by your range and applies the full Gregorian rule, not the simplified one.

isLeap = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0 // 1900 not a leap year, divisible by 100, not by 400 // 2000 leap year, divisible by 400 // 2024 leap year, divisible by 4 // 2100 not a leap year

The century exception exists because the solar year is 365.2422 days, slightly under the 365.25 that a plain every fourth year rule assumes. Skipping three leap days per four centuries corrects the drift. Pope Gregory XIII introduced this in 1582, and it is accurate to about one day in 3,200 years. Note that many older spreadsheets, including Excel, deliberately treat 1900 as a leap year to stay bug compatible with Lotus 1-2-3, so date maths before March 1900 can be off by a day.

Lunar cycles

Total days divided by 29.53, the mean synodic month. That is the average interval between successive new moons. Individual cycles swing between roughly 29.27 and 29.83 days because the Moon’s orbit is elliptical and the Earth is moving around the Sun at the same time, so treat the figure as an average rather than a count you could verify against a specific sky.

Doing the same thing elsewhere

Where people use this

Contract terms and notice periods, employee tenure and probation windows, warranty and returns eligibility, loan and interest day counts, project schedule variance, visa validity windows, medical follow up intervals, and reconciling two systems that report the same period differently. If you have ever had a finance system and a HR system disagree about length of service by one day, inclusive counting was almost certainly the culprit.

Common Questions

Questions About Date Difference Calculator Online Free

The tool subtracts the earlier date from the later date to get the total milliseconds between them. From that it derives the total days, weeks, hours, minutes, and seconds. The exact breakdown in years, months, and days is calculated separately by walking the calendar — subtracting year by year and month by month — so the remainder is always precise and accounts for different month lengths.

Yes. The total days count is based on exact millisecond differences, so February 29 is treated as a real day whenever it falls within the range. The years and months breakdown also handles this correctly because it walks the actual calendar rather than multiplying by a fixed 365.25 days. The extras panel also shows how many leap years fall within your date range.

Total days is the raw count of every calendar day between the two dates. The years, months, and days breakdown shows the same span expressed as a human-readable remainder — the way you would say someone is “3 years, 2 months, and 11 days old” rather than “1,167 days old”. Both figures are accurate; they just represent the same duration in different ways.

Yes. Enter any two dates regardless of order. If the start date is later than the end date, the tool automatically swaps them internally and still returns the correct difference. You can also use the swap button to reverse them yourself. There is no restriction on date range — calculate the gap between historical dates hundreds of years apart or future dates years ahead.

Hit “Set end date to today” to set the start date to today’s date, then change the end date to your target future date. The result shows exactly how many days, weeks, or months remain. Switch to the Days unit for a clean countdown number. The tool updates live as you change either date, so you can adjust the target and see the count shift immediately.

From the blog

Date and time, explained properly

Longer write ups on the calendar problems these tools solve, from ISO week numbering to scheduling across time zones.

Privacy Overview

Cookies let this site remember your preferences and show us which tools people actually use. Full detail sits in our Privacy Policy.