Date Add Months Calculator
Add or subtract months from a date, handling end-of-month correctly.
Parsed as UTC midnight to avoid DST drift.
Whole months only. End-of-month clamping is applied (Jan 31 + 1 month = Feb 28/29).
About
Adding months to a date is the foundation of calendar arithmetic — used for billing cycles, contract anniversaries, lease renewals, subscription renewals, and recurring monthly events. Unlike adding days (which is a simple multiplication of milliseconds), adding months has to respect the varying lengths of months (28-31 days) and the leap-year rule that gives February a 29th day in leap years. The complication is that months are not constant multiples of one day, so any month arithmetic must be calendar-aware, not millisecond-aware.
This calculator uses the underlying JavaScript Date object'ssetUTCMonth() method to add months, then applies end-of-month clamping. Clamping means: if the start day is 29, 30, or 31 and the target month has fewer days, the result is moved back to the last valid day of the target month (so Jan 31 + 1 month = Feb 28 or Feb 29, not Mar 2 or 3). This is the behavior most people expect for billing and scheduling — "the same day of next month, or the closest valid day."
Without clamping, JavaScript's setUTCMonth()rolls over: Jan 31 + 1 month tries to set Feb 31, but February only has 28/29 days, so JS rolls over to March 3 (or March 2 in a leap year). This rollover behavior is rarely what users want; the calculator detects it by comparing the resulting day-of-month to the start day-of-month, and clamps back to the last day of the previous month if a rollover occurred.
All arithmetic is performed in UTC (Coordinated Universal Time) midnight, which sidesteps Daylight Saving Time issues entirely. Local time zones can have 23- or 25-hour days during DST transitions, which can shift results by one day; UTC has no DST, so every day is exactly 86,400,000 ms. The result matches what a paper calendar would show, regardless of where the user is located.
Negative month offsets work identically to positive ones — they just move backward in time. Subtracting 1 month from March 31 lands on Feb 28 (or 29), with the same end-of-month clamping. This is useful for "this date N months ago" calculations in accounting, payroll, and reporting contexts. Adding 12 months is equivalent to adding 1 calendar year (with the Feb 29 edge case: Feb 29 + 1 year = Feb 28 in non-leap years via clamping, or Mar 1 via rollover).
How to Use
- 1Enter the start datePick the date you want to add months to using the date picker, or type YYYY-MM-DD directly. Invalid dates (e.g., 2025-02-31) are rejected.
- 2Enter the number of monthsType the number of months to add. Use a positive number to move forward in time, or a negative number to subtract months.
- 3Use presets for common offsetsThe +1, +3, +6, +12, and -6 month preset buttons cover most scheduling and contract use cases. Click any preset to set the months field instantly.
- 4Read the resulting dateThe hero shows the full weekday, month name, day, and year (e.g., Monday, January 15, 2026). Below it, you'll see the day of week, the offset from today, and the ISO date.
- 5Verify end-of-month handlingIf the start day is 29, 30, or 31, check that the result is correctly clamped to the last day of a shorter target month (e.g., Jan 31 + 1 month = Feb 28/29).
- 6Compare against the tableUse the comparison table showing +1, +3, +6, and +12 month offsets from your chosen start date to sanity-check the result.
Formula
The arithmetic — add months to the month field with end-of-month clamping:
start_ms = Date.UTC(year, month − 1, day)
result = new Date(start_ms)
target_day = result.getUTCDate()
result.setUTCMonth(result.getUTCMonth() + months)
// Clamp end-of-month overflow
if (result.getUTCDate() < target_day) result.setUTCDate(0)
// setUTCDate(0) = last day of previous month
Leap year rule: a year is a leap year if divisible by 4, except centuries not divisible by 400. So 2000 was a leap year, 1900 and 2100 are not, 2024 is, 2025 is not.
End-of-month clamping examples:
- Jan 31, 2025 + 1 month = Feb 28, 2025 (Feb has 28 days in non-leap year)
- Jan 31, 2024 + 1 month = Feb 29, 2024 (Feb has 29 days in leap year)
- Mar 31, 2025 + 1 month = Apr 30, 2025 (Apr has 30 days)
- Aug 31, 2025 + 1 month = Sep 30, 2025 (Sep has 30 days)
Worked Example
Add 12 months to 2025-01-15 (a non-leap year, January has 31 days):
- start = Date.UTC(2025, 0, 15) = January 15, 2025
- setUTCMonth(0 + 12) = setUTCMonth(12) → JS rolls to January 15, 2026 (month 12 = Jan of next year)
- target_day (15) ≤ result.getUTCDate() (15) → no clamping needed
- result = January 15, 2026 (Thursday)
Add 1 month to 2025-01-31 (end-of-month clamping case):
- start = Date.UTC(2025, 0, 31) = January 31, 2025
- setUTCMonth(0 + 1) = setUTCMonth(1) → tries Feb 31, 2025 → JS rolls to Mar 3, 2025 (28 + 3)
- target_day (31) > result.getUTCDate() (3) → clamping triggered
- setUTCDate(0) → Feb 28, 2025 (last day of February in non-leap year)
- result = February 28, 2025 (Friday)
Subtract 6 months from 2025-08-15 (a backward calculation):
- start = Date.UTC(2025, 7, 15) = August 15, 2025
- setUTCMonth(7 + (−6)) = setUTCMonth(1) → Feb 15, 2025
- No clamping (15 ≤ 15)
- result = February 15, 2025 (Saturday)
Tips
- For billing, contracts, and scheduling, use month arithmetic (this calculator) instead of day arithmetic — it respects month boundaries and matches human expectations.
- End-of-month clamping (Jan 31 + 1 month = Feb 28/29) is the most sensible default. If you need rollover instead, use a library like date-fns with the option.
- Adding 12 months ≈ adding 1 year, but they differ for Feb 29 in leap years (clamp gives Feb 28 next year, rollover gives Mar 1). Pick the one matching your business rule.
- Always parse the start date as UTC midnight using Date.UTC — never new Date(y, m, d), which is local-time and DST-fragile.
- For "same day next month" logic (e.g., credit card payment on the 15th), use this calculator; for "30 days from now", use the days calculator — they drift apart by 1-2 days per month.
Common Mistakes
The most common mistakes are: (1) using local time instead of UTC, which can shift results by one day during DST transitions; (2) assuming setMonth() clamps end-of-month — it actually rolls over (Jan 31 + 1 month = Mar 2 or 3 without clamping); (3) confusing "add 12 months" with "add 365 days" — they differ by 1-2 days in leap years; (4) forgetting the Feb 29 → Feb 28 (clamp) vs Mar 1 (rollover) edge case when adding a year to a leap day.
Frequently Asked Questions
- How does the calculator handle adding a month to January 31?
- When you add one month to January 31, the target month (February) is shorter than 31 days, so the calculator clamps the result to the last day of February — Feb 28 in a non-leap year or Feb 29 in a leap year. This matches the most common expectation for calendar arithmetic (the same day-of-month, or the closest valid day). Without clamping, naive setMonth() would roll over to March 2 or 3, which is rarely what people want.
- Does adding 12 months equal adding 1 year?
- Almost always yes, with one edge case: adding 12 months to February 29 in a leap year lands on February 28 of the next (non-leap) year, while adding 1 year lands on March 1 of the next year (because Feb 29 does not exist in non-leap years, JS rolls it over). The behavior depends on how the underlying Date object handles missing days. For non-Feb-29 dates, +12 months and +1 year give the same result.
- Why does the calculator use UTC instead of my local timezone?
- Because UTC has no Daylight Saving Time, every day is exactly 86,400,000 ms. In local time zones like US/Eastern, days can be 23 or 25 hours long during DST transitions, which means date arithmetic can land on the wrong calendar day. Parsing every input as UTC midnight (using Date.UTC) sidesteps this entirely and matches what a paper calendar would show.
- Can I subtract months with a negative number?
- Yes. Enter a negative number of months to subtract. For example, -3 months from July 15 gives April 15. End-of-month clamping applies in both directions — subtracting 1 month from March 31 lands on Feb 28 (or 29 in a leap year) instead of rolling back to March 3.
- What is the difference between adding 1 month vs adding 30 days?
- Adding 30 days is a fixed 30 × 86,400,000 ms offset, so it drifts by 0-2 days relative to the calendar month (which is 28-31 days). Adding 1 month via calendar arithmetic respects month boundaries — Jan 15 + 1 month = Feb 15 (a 31-day month followed by a 28-day month). For billing, scheduling, and contract durations, use month arithmetic; for fixed-time intervals (like interest accrual), use day arithmetic.
- How does the calculator deal with month overflow at year boundaries?
- JavaScript's setUTCMonth handles year rollover automatically — adding 1 month to December 15 gives January 15 of the next year, and adding 13 months to January 15 gives February 15 of the next year. The clamping logic also works across years: Dec 31 + 1 month = Jan 31 (same day, valid in January).
End-of-month handling
Adding months is trickier than adding days because months vary in length (28-31 days). If you start on the 31st of a month and add 1 month, the target month may not have a 31st day. The calculator uses end-of-month clamping: it lands on the last valid day of the target month (so Jan 31 + 1 month = Feb 28 or 29, not Mar 2 or 3). This matches the behavior most people expect for billing, contracts, and scheduling.
Leap year February
February is the only month whose length changes from year to year. In leap years (divisible by 4, except centuries not divisible by 400), February has 29 days; in non-leap years, it has 28. Adding 1 month to January 31 therefore gives Feb 29 in 2024 (leap year) but Feb 28 in 2025 (non-leap year). The calculator detects leap years automatically via the underlying Date object, so the result is always calendar-accurate.
Calendar vs solar year
A calendar year (365 days, or 366 in leap years) is an approximation of the solar (tropical) year, which is about 365.2422 days. Over a 400-year Gregorian cycle, the calendar averages 365.2425 days per year — close enough that the drift is only about 1 day every 3,236 years. Adding 12 months advances by one calendar year; adding 365 days drifts by about 1 day every 4 years (the leap-year correction).
Negative months (subtracting)
Negative month offsets work identically to positive ones — they just move backward in time. Subtracting 1 month from March 31 lands on Feb 28 (or 29), with the same end-of-month clamping. This is useful for rolling back dates for accounting periods, contract anniversaries, or computing "this date N months ago" for reports. Subtracting 12 months is equivalent to subtracting 1 calendar year (with the same Feb 29 edge case).
| Months added | Resulting date | Day of week |
|---|---|---|
| +1 | Saturday, February 15, 2025 | Saturday |
| +3 | Tuesday, April 15, 2025 | Tuesday |
| +6 | Tuesday, July 15, 2025 | Tuesday |
| +12 | Thursday, January 15, 2026 | Thursday |
| +-6 | Monday, July 15, 2024 | Monday |
Adding months is calendar arithmetic, not time arithmetic. The result respects month boundaries (28-31 days) and the leap-year rule for February. For most scheduling and billing use cases, this is the correct behavior; for fixed-interval calculations like interest accrual, use the days calculator instead.
For "same day next month" logic — like a credit card payment on the 15th of every month — use this calculator. For "30 days from now" logic, use the date-add-days calculator; the two will drift by 1-2 days per month because months vary in length.
Authoritative References
- Wikipedia — Calendar— wikipedia.orgOverview of calendar systems including the Gregorian calendar, month lengths, and the conventions for date arithmetic.
- ISO 8601 — Date and time format— wikipedia.orgInternational standard for representing dates as YYYY-MM-DD, which this calculator uses internally to avoid timezone drift.
- NIST — Time and Frequency A-Z— nist.govThe US National Institute of Standards and Technology maintains the official definitions of SI time units, including the second and the day.
Try our other free calculators
CalcGenius has 1,200+ free, ad-free, browser-based calculators for finance, health, math, science, and everyday life. No sign-up required.