Learn how to add or subtract days, months, and years from a date, including how month-length differences get handled.
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 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.
What is January 31 plus 1 month? February doesn’t have 31 days, so there’s no exact equivalent date.
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 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.
The Date Calculator adds or subtracts days, months, or years from any date instantly, handling clamping and leap years correctly.
Date Calculator
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.
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.
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.
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.
Yes, when calculated against the actual calendar, since February simply has the correct number of days built in for whichever specific year is involved.
Find the right tool, or keep reading Brekzy's other guides.