Date Difference Calculator
Count the days, weeks and months between two dates, with both inclusive and exclusive counts and the total in each unit.
"How many months" has several correct answers
The days figure above is unambiguous. The months figure is a judgement call, and reasonable rules give different numbers for the same pair of dates. Two intervals of exactly the same length can differ:
| From | To | Days | Month boundaries crossed | Complete months |
|---|---|---|---|---|
| 2024-01-30 | 2024-02-29 | 30 | 1 | 0 |
| 2024-01-31 | 2024-03-01 | 30 | 2 | 1 |
| 2024-01-31 | 2024-02-29 | 29 | 1 | 0 |
Look at the two rows spanning exactly 30 days. One crosses a single month boundary and the other crosses two, so "one month" and "two months" are both correct depending on what you are counting. Add the second rule — requiring the day of the month to actually have been reached — and you get two more answers. Four defensible numbers for three intervals.
The root cause is that a month is 28, 29, 30 or 31 days, so a month count depends on which months you happened to cross rather than on how long the interval was. This is why two billing systems can genuinely disagree about whether a subscription has run for a month. If a figure has to be agreed between two parties, write it in days.
And adding a month then taking it back does not return you
31 January plus one month has to become 29 February, because 31 February does not exist and clamping to the end of the month is the only sensible rule. Take a month back off and you land on 29 January. The date has moved permanently, through two operations that ought to cancel.
| Start | Plus a month | Minus a month | |
|---|---|---|---|
| 2024-01-31 | 2024-02-29 | 2024-01-29 | moved |
| 2024-03-31 | 2024-04-30 | 2024-03-30 | moved |
| 2024-01-30 | 2024-02-29 | 2024-01-29 | moved |
| 2023-01-29 | 2023-02-28 | 2023-01-28 | moved |
| 2024-05-31 | 2024-06-30 | 2024-05-30 | moved |
| 2024-01-15 | 2024-02-15 | 2024-01-15 | unchanged |
Sweeping every day of 2024 finds exactly 6 dates that fail this way, which sounds negligible until you see which ones: 2024-01-30, 2024-01-31, 2024-03-31, 2024-05-31, 2024-08-31, 2024-10-31. They are month-ends — and month-ends are where billing dates, payroll runs and subscription renewals cluster. The failures land precisely on the dates that matter.
A system that repeatedly adds and subtracts months from a stored result will walk a subscription backwards through the calendar: a renewal set for the 31st becomes the 29th, then the 28th, and never recovers. Nothing warns you, because each individual step was correct.
Two things follow. No date on or before the 28th ever fails, in any year, because every month has at least 28 days — which is why the bug hides so well in testing. And the fix is not a cleverer clamping rule, since every rule has this property: it is to keep the original day of the month and always compute forward from that, rather than iterating on the previous answer. For what it is worth, 2023 fails on 7 dates against 2024's 6, so even the size of the problem moves with the leap year.
How to use
- Enter the two dates.
- Read the difference in days, weeks and months.
- Choose whether to count both endpoints.
- Use the day total for anything that must be exact.
Frequently asked questions
Should I count both end dates?
It depends what you are measuring. The gap between two dates is one number; the count of days in a period including both ends is one more. A hotel stay from the 5th to the 8th is three nights and four days, and both figures are correct answers to different questions.
Why do month counts disagree between tools?
Because months are not a fixed length, so the arithmetic depends on order of operations. Counting whole months first and then leftover days gives a different result from converting everything to days and dividing. Neither is wrong, but they do not match.
How many weeks are in a month?
About 4.35 on average, which is why monthly and weekly budgeting never quite line up. A year has 52 weeks and one or two days left over, so anything scheduled weekly drifts against anything scheduled monthly.
What is the safest unit for calculations?
Days. They are uniform, unlike months, and unambiguous, unlike weeks that may or may not start on Monday. Converting to a day count first and formatting afterwards avoids most date arithmetic bugs.
Does this account for leap years?
Yes — the calculation works through the real calendar rather than assuming a fixed year length, so 29 February is included where it falls. Any method that multiplies years by 365 will drift by a day every four years.
What about times as well as dates?
Dates alone assume midnight to midnight. Where hours matter — a deadline, a booking, a shift — a period of a few hours can push the day count either way depending on rounding, so the time component has to be handled explicitly.
🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.