InfyCalculator
📅

Months Between Dates Calculator

Count the full calendar months and leftover days between two dates, the months as a decimal, years-months-days, total days and weeks — with an option to include the end date, a month-end rule matching Excel’s DATEDIF, and a month-by-month table.

Start date
End date
Include the end date (add 1 day)
When the start day is missing from a month (29th–31st)
Decimal months based on
Loading calculator…

How it works

whole months = calendar month difference, minus 1 if that would pass the end date · leftover days = end − (start + whole months) · decimal months = whole months + leftover ÷ days in the partial month (or total days ÷ 30.436875, or ÷ 30) · with the end date included, the end moves one day later

The calculator walks real calendar months rather than dividing days by 30.4. It counts how many times it can land on the same day-of-month without passing the end date, then measures the leftover days from that anchor. That is why 15 Jan to 15 Sep is exactly 8 months with no remainder, even though the two spans contain different numbers of days. Starts on the 29th, 30th or 31st need a rule for shorter months: by default the month ends on the last day of the short month (Jan 31 → Feb 28 is one month, the way most date libraries add months), or you can follow Excel’s DATEDIF and wait until the same day number comes round. Turn on “Include the end date” when both dates are part of the period, as with a lease or contract from the 1st to the last day of a month. The decimal figure uses the real length of the partial month by default, or an average 30.436875-day month, or 30-day months, and the month-by-month table lists the date each month completes.

Worked example

From 15 Jan 2026 to 15 Sep 2026: each month lands cleanly on the 15th, so 8 whole months pass with 0 leftover days — a total of 243 days, or about 34.7 weeks. From January 1 to June 29, 2022 is 5 months and 28 days: 5 + 28 ÷ 30 = 5.93 months by the calendar, or 179 ÷ 30.436875 = 5.88 average months. A contract from January 1 to June 30, 2026 with the end date included is exactly 6 months.

Sources: Microsoft — DATEDIF function

Frequently asked questions

Why is this different from days ÷ 30?

Calendar months run 28 to 31 days, so a flat 30-day month drifts. Walking the actual calendar makes "the 15th to the 15th" a clean month every time, which the division cannot guarantee. If you need the division anyway, pick 30-day or average months for the decimal figure.

How are leftover days counted?

After the last full month lands on the same day-of-month, the remaining days are counted forward to the end date. If the start day does not exist in a month (the 31st in April, say), the month is counted at that month’s last day unless you choose the DATEDIF rule.

Does this match Excel’s DATEDIF?

Choose “Wait for the same day number, like Excel DATEDIF” under More options and the whole-month count matches DATEDIF(start, end, "m"). The default differs only when the end date is the last day of a month shorter than the start day — Jan 31 to Feb 28 is 1 month by default and 0 months 28 days in Excel.

Should I include the end date?

Include it when the end date is part of the period — a stay, lease or contract that runs through that day. Then January 1 to June 30 is exactly 6 months. Leave it off for elapsed time, such as age or time since an event.

What if I enter the dates backwards?

They are swapped automatically so you always get a positive result, and a note says the swap happened.

Related calculators

This calculator is for educational purposes. Double-check important results before acting on them.