Calculators

Adding and Subtracting Dates: A Practical Guide

Learn how to add or subtract days, months, and years from a date, including how month-length differences get handled.

Brekzy Team Published September 8, 2026

On this page
  1. Adding or Subtracting Days
  2. Adding or Subtracting Months: The Clamping Problem
  3. Adding or Subtracting Years
  4. Common Mistakes
  5. Use the Date Calculator

Adding a number of days to a date is simple arithmetic. Adding months or years is more complicated than it looks, because calendar months don’t all have the same length, as already noted in How Time Units Convert, and that irregularity has to be handled somehow when it’s applied to a real date.

Adding or Subtracting Days

Adding days to a date is the simplest case: just count forward that many days on the calendar, rolling over into the next month or year exactly as the calendar does naturally.

Adding or Subtracting Months: The Clamping Problem

What is January 31 plus 1 month? February doesn’t have 31 days, so there’s no exact equivalent date.

  • January 31, 2025 + 1 month → clamped to February 28, 2025 (2025 is not a leap year)
  • January 31, 2024 + 1 month → clamped to February 29, 2024 (2024 is a leap year)

The standard approach is to clamp the result to the last valid day of the target month when the original day doesn’t exist there.

Adding or Subtracting Years

Adding years is usually simple, except for one specific edge case: adding years to February 29 (a leap day) when the resulting year isn’t a leap year. February 29, 2024 plus 1 year has no February 29, 2025 to land on, so it clamps to February 28, 2025, the same clamping principle as the month case above.

Common Mistakes

  • Assuming every month addition lands on the same day number. It only works cleanly when the target month actually has that many days; otherwise the date has to clamp to the nearest valid day.
  • Forgetting leap years affect date arithmetic. Adding or subtracting across February requires knowing whether the relevant year is a leap year, since that changes whether February 29 exists at all.
  • Doing date math by counting a fixed 30 days per month. This shortcut is convenient but inaccurate, real months range from 28 to 31 days, so it drifts further off the correct date the more months are involved.

Use the Date Calculator

The Date Calculator adds or subtracts days, months, or years from any date instantly, handling clamping and leap years correctly.

Try it yourself

Date Calculator

Try our Date Calculator →

Frequently Asked Questions

What is January 31 plus one month?

Since February doesn’t have 31 days, the result clamps to the last day of February, either the 28th or 29th depending on whether it’s a leap year.

How do I add months to a date correctly?

Move to the same day number in the target month if it exists there; if it doesn’t (because the target month is shorter), clamp to the last valid day of that month instead.

What happens when you add a year to February 29?

If the resulting year isn’t a leap year, there’s no February 29 to land on, so the result clamps to February 28 instead.

Is it accurate to assume every month has 30 days for date math?

No. Real calendar months range from 28 to 31 days, so treating every month as exactly 30 days produces a date that drifts further from correct the more months are added or subtracted.

Does adding days to a date account for leap years automatically?

Yes, when calculated against the actual calendar, since February simply has the correct number of days built in for whichever specific year is involved.

Explore More

Find the right tool, or keep reading Brekzy's other guides.