# Date Add/Subtract Calculator

- **URL:** https://codeasystem.com/calculators/dates/date-add-subtract-calculator/
- **Category:** dates
- **Description:** Add or subtract days, weeks, months or years from any date and get the resulting calendar date in clean ISO format.
- **Primary output:** Resulting date: 2024-02-29

## Inputs
- Start date (name: `start`, type: date, example: 2024-01-31)
- Direction (name: `direction`, type: select)
- Amount (name: `amount`, type: number, example: 1)
- Unit (name: `unit`, type: select)

## Outputs
- Resulting date: 2024-02-29
- Start date: 2024-01-31
- Applied: + 1 months

## Formula / methodology
```
Result = start ± amount × unit
Month-end rule: clamp the day to the target month’s last day
```

Days and weeks shift the underlying UTC timestamp directly. Months and years advance the calendar month (or twelve of them per year) while keeping your day-of-month; clamped down to the last valid day when the target month is shorter. That means Jan 31 + 1 month = Feb 28 in common years and Feb 29 in leap years, matching how contracts and subscriptions behave.

## Assumptions & limitations
- Whole amounts only; fractional entries are rounded to integers.
- Clamping convention: overflow days are dropped, never rolled into the next month.
- Results are ISO yyyy-mm-dd calendar dates with no timezone component.

## How to use
1. **Set the starting date**; Any calendar date from the picker works.
2. **Choose direction, amount and unit**; For example: subtract 2 years, or add 45 days.
3. **Read the resulting date**; Shown as yyyy-mm-dd; the rows restate exactly what operation was applied.

## Example
Adding 1 month to 2024-01-31 lands on 2024-02-29; the leap-year clamp keeps the result inside February instead of spilling into March.

Result for these inputs:

```
Resulting date: 2024-02-29
```

## About this calculator
### The month-end clamping rule, explained

January 31 plus “one month” has no unambiguous answer because February never has a 31st. Libraries differ wildly: some roll into early March, others clamp. This calculator clamps; Jan 31 + 1 month = Feb 28 (or Feb 29 in a leap year); because that matches how billing cycles, leases and legal deadlines are conventionally measured.

### Why ISO output

Formatting the result as yyyy-mm-dd removes ambiguity for international teams: “03/04/2026” means March 4 in one country and April 3 in another, while ISO reads identically everywhere and sorts correctly in spreadsheets.

### Chaining operations

Need “three months after the contract ends, plus ten days”? Run the calculator twice, feeding each result into the next start field. Chaining keeps each step auditable instead of hiding it inside one compound formula.

## FAQs
### What happens when adding a month overshoots a short month?

The day is clamped to that month’s last day: Jan 31 + 1 month gives Feb 28 in common years and Feb 29 in leap years.

### Does subtracting work the same way?

Yes; choose Subtract and the same clamp logic applies backwards, e.g. Mar 31 − 1 month = Feb 28/29.

### Can I enter fractional amounts?

Amounts are rounded to whole units before computing; use days with a larger count instead of fractional months.

### Are timezones considered?

No; dates are treated as pure UTC calendar dates, so the output is identical wherever you run it.

## Related calculators
- [Days Between Dates Calculator](https://codeasystem.com/calculators/dates/days-between-dates-calculator/)
- [Working Days Calculator](https://codeasystem.com/calculators/dates/working-days-calculator/)
- [Time Duration Calculator](https://codeasystem.com/calculators/dates/time-duration-calculator/)

---
Last updated: 2026-08-23 · Version: 1.0.0 · [HTML version](https://codeasystem.com/calculators/dates/date-add-subtract-calculator/)
