Date Difference Calculator
Find the exact time between two dates in years, months and days — plus the total months, weeks, days and hours. Works for past or future dates, ages, deadlines and anniversaries.
Updated 2026-06-09 · Free · No sign-up · Runs privately in your browser
What is a date difference calculator?
A date difference calculator finds the exact amount of time between two dates and shows it two ways: as a calendar breakdown of years, months and days, and as running totals of months, weeks, days and hours. It is the fastest way to answer questions like “how old am I in days?”, “how long until the deadline?”, or “how many weeks until the wedding?” without counting on a calendar by hand.
Enter a start date and an end date in any order. The tool measures the real gap between them, automatically accounting for months of different lengths and for leap years, so the answer is precise rather than a 30-day-per-month estimate.
How does the date difference calculator work?
The calculator computes the calendar breakdown with a borrow-days/borrow-months method, then derives the totals by dividing the raw gap. Here is the exact method the widget uses.
First it finds the naive difference of each field:
years = end year − start yearmonths = end month − start monthdays = end day − start day
Then it borrows where a field is negative:
- If
daysis below zero, subtract 1 frommonthsand add the number of days in the month before the end month todays. - If
monthsis then below zero, subtract 1 fromyearsand add 12 tomonths.
Finally it computes the totals from the raw millisecond gap:
total days = round((end − start) ÷ 86,400,000)— milliseconds in a daytotal months = years × 12 + monthstotal weeks = floor(total days ÷ 7)total hours = total days × 24
If you enter the dates in the wrong order, the tool swaps them so the result is always a positive, absolute difference.
How is the years, months and days breakdown calculated?
The breakdown uses the borrow method above so each unit reflects real calendar lengths. Consider two worked examples that match the widget exactly.
Example A — a long span: Start 15 January 2020, end 9 June 2026.
- years = 2026 − 2020 = 6; months = June − January = 5; days = 9 − 15 = −6.
- days is negative, so borrow: months become 4, and add the days in May (31) to give days = 25.
- months (4) is not negative, so no further borrow.
- Result: 6 years, 4 months, 25 days. Totals: 76 months, 333 weeks, 2,337 days, 56,088 hours.
Example B — a short span: Start 10 February 2024, end 30 August 2024.
- years = 0; months = August − February = 6; days = 30 − 10 = 20. No borrowing needed.
- Result: 0 years, 6 months, 20 days. Totals: 6 months, 28 weeks, 202 days, 4,848 hours.
The table below summarises both runs.
| Field | Example A | Example B |
|---|---|---|
| Start date | 2020-01-15 | 2024-02-10 |
| End date | 2026-06-09 | 2024-08-30 |
| Years / months / days | 6y 4m 25d | 0y 6m 20d |
| Total months | 76 | 6 |
| Total weeks | 333 | 28 |
| Total days | 2,337 | 202 |
| Total hours | 56,088 | 4,848 |
Notice that the totals are not simply the breakdown re-stacked. Total days come from the true millisecond gap, while total months come from the years-and-months breakdown, so they stay consistent with the calendar rather than assuming every month is 30 days.
What is the difference between inclusive and exclusive counting?
Exclusive counting measures the elapsed gap between two dates; inclusive counting counts every calendar day touched, including both endpoints. This calculator uses exclusive counting, so its day total is the number of nights or full gaps between the dates.
The two differ by exactly one day. If you need inclusive counting, add one.
| Question | Method | Days for 1–5 June |
|---|---|---|
| How many nights in a hotel? | Exclusive (elapsed) | 4 |
| How many days does the event run? | Inclusive (count both ends) | 5 |
| How old am I in days? | Exclusive (elapsed) | 4 |
A simple rule: use exclusive for durations, ages and “time until”, and inclusive when every day is itself an item you are counting, such as billing days, vacation days or conference days.
What can you use a date difference calculator for?
The same calculation answers many everyday questions:
- Exact age: set the start date to a date of birth and the end date to today to get age in years, months and days. For an age-specific tool, see the chronological age calculator.
- Deadlines and countdowns: measure how long until a launch, exam, due date or contract expiry.
- Anniversaries and milestones: find how many months or weeks until a wedding, work anniversary or a “10,000 days together” milestone.
- Project planning: convert a span into total weeks or hours for scheduling and timesheets.
- Legal and finance windows: check notice periods, warranty lengths and waiting periods (confirm the required counting method first).
You can browse more tools for working with calendars in the date-time tools category.
What are common mistakes and limitations?
A few things to keep in mind so your result means what you expect:
- Off-by-one from counting both ends. The tool gives elapsed time. Add one day for inclusive counts. This is the single most common error in deadline and billing math.
- Months are not 30 days. Estimating with 30-day months drifts over long spans. Always trust the calendar breakdown over a “total days ÷ 30” shortcut; for example, 202 days is 6 months and 20 days here, not 6.7 months.
- Whole weeks are rounded down. The weeks total shows completed weeks only. In a 13-day gap you get 1 week, with the leftover days kept in the day total.
- Time of day is ignored. Both dates are treated as midnight, so partial days and time zones are not included; the hours figure is simply total days times 24.
- Daylight saving and time zones. Because the math uses whole calendar days at local midnight, ordinary clock changes do not affect the day count.
Note: This tool is for general planning and information only. For legally or financially significant deadlines — court filings, statutes of limitation, contract notice periods or interest accrual — confirm the exact counting rules that apply, as some jurisdictions count differently and may exclude weekends or holidays.
How accurate is the result?
For whole-day calendar spans the result is exact: it counts real days, real month lengths and leap years, including 29 February when a leap day falls inside the interval. The only intentional simplifications are that times of day are dropped and weeks are rounded down to full weeks, both of which are standard for date-gap math. If you need precise time-of-day spans (hours and minutes within a day), use a dedicated time tool instead, then combine it with the day count from this calculator.
Frequently asked questions
How do you calculate the number of days between two dates?+
Subtract the earlier date from the later one and divide by the length of one day (86,400 seconds). The calculator also breaks the gap into exact years, months and days, borrowing days from the previous month and months from the year where needed.
Does it count both the start and end date?+
No. The result is the elapsed time between the two dates, which is exclusive counting. To count both endpoints (inclusive counting, common for hotel nights or event days), add one day to the total.
Can it handle dates in the past and future?+
Yes. Enter any two dates in either order. If the end date is earlier than the start date, the tool swaps them and returns the absolute difference, so the result is never negative.
How many days are between two dates one year apart?+
Either 365 or 366 days, depending on whether a 29 February (a leap day) falls inside the interval. The calculator counts real calendar days, so it handles leap years automatically.
Why does the months figure differ from total days divided by 30?+
Months are not all the same length. The tool counts real calendar months using the borrow method, so February, 30-day months and 31-day months are all measured correctly rather than approximated as 30 days.
How do I find someone's exact age?+
Set the start date to the date of birth and the end date to today. The years, months and days line is the exact age, and the totals give age in months, weeks, days and hours.
What is the difference between elapsed days and inclusive days?+
Elapsed (exclusive) days count the nights or gaps between dates; inclusive days count every calendar day touched, including both endpoints. Inclusive days always equal exclusive days plus one.
How many weeks are between two dates?+
Divide the total days by 7 and round down. The calculator shows full completed weeks, so 13 days is reported as 1 week with the remainder kept in the days total.