ThisCalculator

Everyday

Last n Months: Meaning, Use & Calculator

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

This calculator works out what date it was or will be n months before or after a given start date. You enter a start date and a number of months; you get back the exact end date, plus the number of days in that period and the day of the week. The result uses calendar months, not 30-day chunks, so month-end dates are handled correctly.

Formula

The core rule is simple: add or subtract the number of months to the month number of the start date, keeping the same day-of-month. The formula is:

End date = Start date ± n months

Where:

  • Start date – the date you begin from (e.g., 2024-01-31)
  • n – the number of months to add (positive) or subtract (negative)
  • End date – the resulting date after the month shift

The tricky part is month-end clamping. If the start day is the 31st and the target month has only 30 days (or 28/29 in February), the date is clamped to the last valid day of that month. For example, adding 1 month to January 31 gives February 28 (or 29 in a leap year), not March 3.

Worked Example

Using the defaults: start date 2024-01-31, n = 3 months, direction = After.

  1. Start month is January (month 1). Add 3 months → month 4, which is April.
  2. Keep the day: 31. April has 30 days, so clamp to April 30.
  3. End date = 2024-04-30.
  4. Days between Jan 31 and Apr 30: Jan 31→Feb 29 (leap year) = 29 days, Feb 29→Mar 31 = 31 days, Mar 31→Apr 30 = 30 days. Total = 90 days.
  5. Day of week: April 30, 2024 is a Tuesday.

The calculator shows: End date 2024-04-30, Days 90, Weekday Tuesday – matching the steps above.

Why Calendar Months Differ from 30-Day Months

A common mistake is treating “3 months” as 90 days. That works only if every month has exactly 30 days, which none do. February has 28 or 29, and the other months alternate 30 and 31. Over a year, the average month is about 30.44 days. So if you need a precise 90-day period (e.g., for a warranty or a trial), you should add 90 days, not 3 months. If you need “3 calendar months” (e.g., for a lease or subscription renewal), you must use the month-shift method, which this calculator does.

How to Read the Result

The end date is the primary answer. The “days in period” is a helper that tells you the exact number of days between the start and end dates, which is useful for planning or comparing with a fixed-day count. The weekday is just informational – it can help you confirm the date feels right (e.g., if you expected a Monday and got a Tuesday, double-check your inputs).

If you choose “Before,” the calculator subtracts the months. For example, start 2024-03-31, n=1, Before → 2024-02-29 (leap year). Note that subtracting 1 month from March 31 also clamps to February 29, not March 2.

Common Mistakes and Edge Cases

  • Ignoring month-end clamping: Adding 1 month to Jan 31 gives Feb 28/29, not Mar 2 or Mar 3. Always check the target month’s length.
  • Leap years: February 29 exists only in leap years. Adding 1 month to Jan 29 in a non-leap year gives Feb 28; in a leap year, Feb 29.
  • Negative n: You can enter a negative number of months, but it’s clearer to use the direction selector. The calculator accepts both.
  • Day-of-month drift: If you add 1 month repeatedly (e.g., Jan 31 → Feb 28 → Mar 28), the day can drift from 31 to 28. This is standard calendar behavior, but be aware if you expect the same day each month.
  • Rounding days: The days count is exact, not rounded. Use it as-is.

When to Use This Calculator

Use this when you need a calendar-month offset, not a fixed-day offset. Typical situations:

  • Subscription renewals (monthly plans)
  • Lease or rental periods
  • Medical follow-up appointments (e.g., “come back in 3 months”)
  • Project milestones (e.g., “review in 6 months”)
  • Warranty periods that specify months

If you need a fixed number of days (e.g., 90 days), use a date-difference calculator or add days directly. The two are not interchangeable.

Limits of the Formula

The formula assumes standard Gregorian calendar rules. It does not account for:

  • Business days (weekends/holidays) – that’s a separate calculation
  • Time zones – dates are treated as local calendar dates
  • Historical calendar changes (e.g., Julian to Gregorian) – not relevant for modern dates

Also, the “days in period” count includes both the start and end dates? No – it counts the number of 24-hour periods between them. For Jan 31 to Feb 28 (non-leap), the count is 28 days, not 29. This is the standard difference, not an inclusive count.

Frequently Asked Questions

Does “3 months” mean 90 days?

No. Three calendar months can be 89, 90, 91, or 92 days depending on the months involved. For example, February–April (non-leap) is 89 days, while March–May is 92 days. If you need exactly 90 days, add 90 days, not 3 months.

What happens if I add 1 month to January 31?

You get February 28 (or 29 in a leap year). The calculator clamps to the last day of February because February has no 31st. This is the standard convention used in most date libraries.

Why does the day of the month change when I add months repeatedly?

Because of clamping. Starting Jan 31, adding 1 month gives Feb 28, then adding another month gives Mar 28 (not Mar 31). The day “sticks” to the clamped value. If you want to keep the 31st, you need to manually adjust after the first addition.

Can I use this for billing cycles?

Yes, but check your provider’s rules. Some bill on the same day each month (e.g., the 15th), while others use the last day of the month. This calculator follows the calendar-month rule, which matches most subscription services.

Is there a difference between “1 month” and “30 days”?

Yes. One month is a calendar month (Feb 15 to Mar 15, for example). Thirty days is a fixed duration (Feb 15 to Mar 16 in a non-leap year). For legal or contractual terms, always confirm which definition applies.

What if I need to count business days instead?

This calculator counts all calendar days. For business days, you need a separate tool that excludes weekends and holidays, which requires a holiday calendar specific to your country or region.

Related

Formula used
in start | Start date | - | 2024-01-31 | 0
in n | Number of months | - | 3 | -120
sel dir | Direction | Before=0, After=1 | 1
out end | End date | - | date_add(start, dir * n, 'month') | 0
out days | Days in period | days | abs(date_diff(start, end, 'day')) | 0
out weekday | Day of week | - | weekday(end) | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.