日期加减计算器
从任意日期加减天数、周数、月数或年数,即时计算未来或过去的日期。计算器以完整格式显示结果日期、星期几、ISO 日期字符串和从起始日起的总天数,自动处理闰年和月份长度变化。
常见问题
如何给日期增加天数?
给日期增加天数时,输入起始日期,填写要增加的天数,选择「天」作为单位,然后点击增加。计算器即时显示结果日期和星期几。例如,在 2026 年 1 月 1 日基础上增加 30 天,得到 2026 年 1 月 31 日(星期六)。
从今天起 30 天是哪天?
使用日期加减计算器:将起始日期设为今天,在数量字段输入 30,选择天,然后点击增加。结果会显示从现在起 30 天后的确切日期和星期几。
如何从日期中减去天数?
输入起始日期,填写要减去的天数,选择「天」作为单位,然后点击减去。计算器会准确找到过去的日期,考虑各月天数变化和闰年。
在 1 月 31 日基础上增加 1 个月会发生什么?
在 1 月 31 日基础上增加 1 个月会落在 2 月 31 日,但这个日期不存在。计算器使用 JavaScript 原生日期处理,会将溢出滚动到下个月——因此 1 月 31 日 + 1 个月变为 3 月 3 日(闰年则为 3 月 2 日)。
如何查找从现在起 90 天后的日期?
将起始日期设为今天的日期,在数量字段输入 90,从单位下拉菜单选择天,然后点击增加。计算器会考虑各月天数和闰年,给出从现在起正好 90 个日历天后的准确日期。
增加天数和增加月份有什么区别?
增加天数始终将日历推进固定天数(如 +30 天总是 30 天)。增加月份按日历月份推进,各月长度不同(28-31 天)。在 1 月 15 日增加 1 个月得到 2 月 15 日,但增加 31 天只有在 1 月(31 天的月份)时才得到 2 月 15 日。
给日期增加年份时如何处理闰年?
给日期增加年份时,计算器会自动考虑闰年。唯一的边界情况是 2 月 29 日(闰日):在 2024 年 2 月 29 日基础上增加 1 年会落在 2025 年 2 月 29 日,但 2025 年不是闰年,因此结果为 2025 年 3 月 1 日。
能通过减去来计算过去的日期吗?
可以。选择减去,输入数量和单位,计算器就会找到过去的日期。例如,从 2026 年 12 月 31 日减去 6 个月得到 2026 年 6 月 30 日。可以减去天、周、月或年。
What is a Date Add/Subtract Calculator?
A date add/subtract calculator lets you quickly find a future or past date by adding or subtracting a specific number of days, weeks, months, or years from any starting date. Whether you need to calculate a project deadline 90 days from now, find the date 6 months before an anniversary, or figure out what day falls 52 weeks from today, this tool gives you an instant answer along with the day of the week and ISO date string.
How to Add Days to a Date
To add days to a date manually, start from your chosen date and count forward through the calendar, taking into account the varying lengths of each month and whether the year is a leap year.
- Enter your start date in the date picker above
- Type the number of days (or weeks, months, years) you want to add
- Select Days as the unit from the dropdown
- Click Add to calculate the future date
- The result shows the full date, day of the week, and ISO format
Example: Adding 45 days to January 20, 2026 means counting 11 remaining days in January, 28 days in February (2026 is not a leap year), and 6 more days into March — giving March 6, 2026 (a Friday).
Month Addition Edge Cases
Adding months to a date is more complex than adding days because months have different lengths. The most common edge case is month overflow: adding one month to January 31 would land on February 31, which does not exist. JavaScript's built-in Date object handles this by rolling over into the next month — so January 31 + 1 month becomes March 3 (or March 2 in a leap year).
| Start Date | + Months | Result |
|---|---|---|
| Jan 31, 2026 | +1 | Mar 3, 2026 (overflow) |
| Jan 31, 2024 | +1 | Mar 2, 2024 (leap year overflow) |
| Jan 30, 2026 | +1 | Mar 2, 2026 (Feb has 28 days) |
| Jan 15, 2026 | +1 | Feb 15, 2026 (no overflow) |
If you need to always land on the last day of the resulting month (e.g., Jan 31 + 1 month = Feb 28), you would need a custom clamping function. This calculator uses JavaScript's native overflow behavior, which is standard across date libraries.
Leap Year Handling
A leap year has 366 days with February containing 29 days instead of 28. When you add days, weeks, or years to a date, the calculator automatically accounts for leap years so you always get the correct result.
- A year is a leap year if it is divisible by 4 (e.g., 2024, 2028)
- Century years (divisible by 100) are not leap years, e.g., 1900, 2100
- Exception: years divisible by 400 are leap years, e.g., 2000, 2400
Leap year example: Adding 1 year to February 29, 2024 (a leap day) would normally land on February 29, 2025 — but 2025 is not a leap year, so JavaScript rolls over to March 1, 2025.
Common Use Cases
| Use Case | Example |
|---|---|
| Project deadline | Today + 90 days |
| Warranty expiry | Purchase date + 1 year |
| Trial period end | Sign-up date + 30 days |
| Contract notice period | Today + 2 weeks |
| Medical follow-up | Appointment + 6 weeks |
| Subscription renewal | Start date + 1 month |
| Past date lookup | Today - 6 months |
How the Calculator Works
The calculator uses JavaScript's native Date object for all arithmetic:
- Days: Calls
setDate(getDate() + n), which automatically rolls over month and year boundaries - Weeks: Multiplies the week count by 7 and uses the same day offset logic
- Months: Calls
setMonth(getMonth() + n), with native overflow handling for short months - Years: Calls
setFullYear(getFullYear() + n), with leap day overflow for Feb 29
The "days from start" figure is calculated by dividing the millisecond difference between the result date and start date by 86,400,000 (milliseconds per day).
Related Tools
- Date Calculator — Calculate the number of days between two dates
- Countdown Calculator — Count down days, hours, minutes to a specific date
- Age Calculator — Calculate exact age in years, months, and days
- Half Birthday Calculator — Find the date exactly halfway between two birthdays