Learn & Understand

Why Calendar-Month Arithmetic Is Ambiguous and Non-Reversible

In a hurry? Skip straight to the numbers.

Open the Date Difference Calculator →

The companion calculator expresses the gap between two dates both as a calendar breakdown, years, months, and days, and as a raw total of days. The total-days figure is unambiguous. The calendar-months figure, however, sits on top of one of the quiet messes of timekeeping: a "month" has no fixed length, and adding or subtracting months does not behave like ordinary arithmetic. Understanding why month arithmetic is ambiguous and non-reversible explains a whole class of scheduling bugs and clarifies what a "months" figure really means.

A Month Has No Fixed Length

The root of the trouble is that months vary from 28 to 31 days, so "one month" is not a fixed span of time. When you say two dates are "two months apart," the actual number of days depends on which two months you crossed. This is why the same calendar difference of "two months" can represent different numbers of days in different parts of the year, and why the calculator gives a separate exact day count. The calendar breakdown speaks in human terms; the day count speaks in exact ones, and the two cannot always be cleanly reconciled because the unit itself is elastic.

The End-of-Month Problem

The elasticity produces a specific, notorious headache: what is "one month after January 31"? February has no 31st, so the answer must be fudged to February 28 (or 29 in a leap year), or rolled to early March, depending on the convention.

The end-of-month ambiguity
Start date"One month later" could be
January 31February 28/29, or March 3
January 30February 28/29, or March 2
March 31April 30, or May 1

There is no single correct answer, only conventions, and different systems choose differently. This is why monthly subscriptions, medication schedules, and contract dates that land near the end of a month can behave surprisingly, the software had to pick a rule for a case that has no natural answer.

Why It's Not Reversible

The deepest oddity is that month arithmetic is not reversible: adding a month and then subtracting a month does not always return you to where you started. Add one month to January 31 and you might land on February 28; subtract one month from February 28 and you land on January 28, not January 31. The clamping to the end of a short month loses information that cannot be recovered. Ordinary numbers do not behave this way, adding and subtracting the same amount always returns the original, but calendar months do, because the operation is lossy at month boundaries. This non-reversibility is a genuine trap for anyone assuming date math works like number math.

Order Matters Too

Relatedly, the order of operations can change the result. Adding a month and then a day may give a different date than adding a day and then a month, because the intermediate clamping differs. This means month-based date arithmetic is not associative or commutative in the way we expect from arithmetic, and combining month and day adjustments requires care about the sequence. Software libraries make deliberate, documented choices about all this, but those choices are conventions papering over a fundamentally ambiguous operation.

What the "Months" Figure Really Means

Given all this, the calendar-months difference the calculator reports is best understood as a human-friendly description, "about two and a half years," "six months and a few days", rather than an exact, reversible quantity. For anything requiring precision, billing, interest, deadlines, the total-days count is the reliable figure, because days are a fixed unit while months are not. The two views answer different needs: the calendar breakdown for how people talk, the day count for exact computation.

Measuring Date Gaps Wisely

Use the calculator's calendar breakdown to describe a span in natural terms, and its total-day count when you need an exact, well-behaved number. Remember that months have no fixed length, that "one month later" near a month's end is genuinely ambiguous, and that adding and subtracting months is non-reversible and order-dependent. The calculation gives both views; understanding why month arithmetic is ambiguous is what tells you which view to trust for a given purpose.

Ready to Put This Into Practice?

Now that you understand how it works, plug in your own numbers and get an instant, accurate result.

Use the Date Difference Calculator Now →