Understand this tool
Add and subtract calendar dates accurately
- What the concept means
- Calendar date arithmetic adds or subtracts civil units such as years, months, weeks, and days.
- Why it exists
- It handles variable month lengths and leap years explicitly instead of treating every month as a fixed duration.
- When to use it
- Use it for planning by calendar units when the page’s month-end rule matches the intended convention.
- What the result means—and does not mean
- The result is a civil date. It does not decide legal deadlines, business-day adjustments, time zones, or whether another system rolls overflowing days forward.
Why “one month” is not a fixed number of days
Months contain 28 to 31 days. Adding one month to January 31 therefore needs a policy because February has no matching day. This tool clamps to the last valid day of the target month.
Years and months are applied before weeks and days so the operation is deterministic. Another application may apply units in a different order or use overflow semantics and get a different valid result.
Key concepts
Key concepts
- Civil calendar arithmetic
- Operations on named calendar dates.
- Month length
- The varying number of days in a calendar month.
- Month-end clamping
- Moving an invalid target day to the target month’s last day.
- Leap year
- A Gregorian year containing February 29.
- Fixed duration
- An exact number of hours, seconds, or days.
Method or process
How the process works
Why “one month” is not a fixed number of days
Months contain 28 to 31 days. Adding one month to January 31 therefore needs a policy because February has no matching day. This tool clamps to the last valid day of the target month.
Years and months are applied before weeks and days so the operation is deterministic. Another application may apply units in a different order or use overflow semantics and get a different valid result.
Compare the concepts
Calendar month versus fixed days
| Addition | Meaning | Possible January 31 result |
|---|---|---|
| 1 calendar month | Same day if valid, otherwise clamp | February 28 or 29 |
| 30 fixed days | Exactly thirty date boundaries | A date in early March |
Common mistakes
Common mistakes
- Assuming a month always means 30 days.
- Ignoring the order of multiple units.
- Treating the result as a business deadline.
Edge cases and limits
Edge cases and limits
- Month-end inputs expose rule differences.
- Leap years follow Gregorian divisibility rules.
- Negative units reverse the operation but retain the same policy.