🗓️ Date Add & Subtract
Add or subtract years, months, days, hours, minutes and seconds from a base date and time to get the resulting moment.
📐 工作原理与说明
目标日期 = 基准日期 + 年、月、日、时、分、秒增量(负数表示减);年月按日历月推进,目标月无对应日时夹到该月月末(如 1 月 31 日加 1 月取 2 月末、2024-02-29 加 1 年取 2025-02-28);日按日历日推进并保留原时刻,自动跨月跨年;时/分/秒按固定时长累加。
请输入数值
📐 公式说明
支持负数减法:输入 -7 表示减去 7 天
年/月按历法加减(考虑闰年与各月天数)
日按日历日推进(保留原有时刻);时/分/秒按固定时长累加
跨月跨年自动进位:1/31 + 1 月 = 2/28(或 2/29 闰年)
例:2024-01-30 + 1 月 = 2024-02-29(取月末)
📚 深度解析:日期加减计算器
💡 常见使用场景
- 算 N 天后/前的日期。
- 合同起算日加 30 个自然日,或提前 7 天提醒,直接得到目标日期。
计算
2026-01-01 + 30 天 = 2026-01-31;−7 天 = 2025-12-25。
❓ 常见问题(FAQ)
- 月末溢出?
- 自动进位到下一月。
- 加 1 个月如何处理月末?
- 按日历月推进,若目标月无对应日则顺延到该月最后一天(如 1/31 加 1 月 → 2/28 或 2/29)。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Calendar arithmetic | add field by field and clamp to the last day of the target month | ISO 8601 |
| Working days | working days exclude weekends and public holidays by region | ISO 8601 |
| Interval notation | durations express as a year, month and day combination | ISO 8601-1 |
⚠️ 使用说明与注意事项
- 本工具纯前端运行,数据不会上传到服务器
- 建议在主流浏览器(Chrome/Safari/Firefox/Edge)中使用
- 计算结果仅供参考,请以实际应用场景为准