🗓️ 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)中使用
- 計算結果僅供參考,請以實際應用場景為準