Reviewed by CalculatorApp.me Editorial Team
Month clamping, business day rules, Julian Day arithmetic, and ISO 8601 date math explained.
365/366
Days in ordinary vs. leap year
97/400
Leap years in every 400-year Gregorian cycle
ISO 8601
International date arithmetic standard (YYYY-MM-DD)
Business days
MonβFri only; exclude weekends & public holidays
Add or subtract days, months, and years from any date. Features countdown timer, recurring events, and quick presets for deadlines and planning.
Enter values above to see results.
Explore our in-depth guides related to this calculator
Everything you need to know about mortgages β calculate payments, compare rates, understand amortization, and plan your home purchase with expert-reviewed tools.
Expert-reviewed guide to BMI calculation, healthy weight ranges, limitations of BMI, and alternative health metrics. Includes free BMI calculator.
Comprehensive tax planning guide with free calculators. Covers federal tax brackets, deductions, credits, and strategies to minimize your tax burden.
Date addition calculates the future or past date that results from adding or subtracting a number of days, weeks, months, or years to a starting date. While adding days is straightforward arithmetic, adding months and years requires month-end clamping β ensuring the resulting date falls within the valid range of the target month.
For example: January 31 + 1 month cannot be February 31 (February has 28 or 29 days). The correct result is February 28 (or 29 in a leap year). This clamping behavior is defined in RFC 5545 (iCalendar) and is implemented consistently in ISO 8601-compliant libraries.
Business day addition is a separate calculation β it skips weekends (Saturday and Sunday) and often public holidays, which vary by country and jurisdiction. Finance and law rely heavily on business day counting for payment deadlines, contract terms, and court filing timelines.
JDN(Y,M,D) = D - 32075 + 1461 Γ (Y + 4800 + (M-14) Γ· 12) Γ· 4 + 367 Γ (M - 2 - (M-14) Γ· 12 Γ 12) Γ· 12 - 3 Γ ((Y + 4900 + (M-14) Γ· 12) Γ· 100) Γ· 4 // Add days: newJDN = JDN(startDate) + daysToAdd // Convert back to calendar date
Julian Day Number converts any Gregorian date to an integer, making day addition trivially simple.
function addMonths(date, n) {
const result = new Date(date);
const targetMonth = result.getMonth() + n;
result.setMonth(targetMonth);
// Clamping: if month overflowed,
// set to last day of target month
if (result.getMonth() !== ((targetMonth % 12) + 12) % 12) {
result.setDate(0); // last day of prev month
}
return result;
}JavaScript's Date handles most clamping automatically. Always verify month didn't overflow for Jan 31, Mar 31, etc.
function addBusinessDays(date, days) {
let count = 0;
const result = new Date(date);
while (count < days) {
result.setDate(result.getDate() + 1);
const dow = result.getDay(); // 0=Sun, 6=Sat
if (dow !== 0 && dow !== 6
&& !isPublicHoliday(result)) {
count++;
}
}
return result;
}Public holidays require a country-specific list. For US: New Year's, MLK Day, Presidents Day, Memorial Day, Independence Day, Labor Day, Thanksgiving, Christmas.
| Starting Date | Operation | Naive Result | Clamped Result | Reason |
|---|---|---|---|---|
| Jan 31 | + 1 month | Feb 31 | Feb 28 (or 29*) | February has 28/29 days |
| Mar 31 | + 1 month | Apr 31 | Apr 30 | April has only 30 days |
| Oct 31 | + 1 month | Nov 31 | Nov 30 | November has only 30 days |
| Feb 29 (leap) | + 1 year | Feb 29 | Feb 28 | Next year may not be leap year |
| Jan 31 | + 3 months | Apr 31 |
Julius Caesar reformed the Roman calendar by adding February 29 every 4 years, creating a 365.25-day year β the first systematic approach to calendar arithmetic.
Pope Gregory XIII corrected the Julian Calendar's accumulated 10-day drift by skipping leap years on century years (except multiples of 400), producing today's 365.2425-day year.
John Herschel's Julian Day Number system was adopted by astronomers as a continuous count of days from January 1, 4713 BC β making date subtraction a simple integer operation.
The International Organization for Standardization published ISO 8601, standardizing date formats (YYYY-MM-DD), durations (P1Y2M3DT4H), and interval notation for international use.
ISO 8601:2019
Defines date formats (YYYY-MM-DD), durations (P1Y2M3D), and interval arithmetic as the international standard adopted in all modern date libraries.
RFC 5545
Specifies RRULE recurrence rules, duration types, and exclusion dates. Defines how calendar applications (Google Calendar, Outlook) calculate date addition.
IERS
Manages UTC and leap seconds. Provides definitive records of when leap seconds were added, affecting precise date-time arithmetic over long periods.
TC39 Temporal
The Temporal API (Stage 3) brings correct ISO 8601 date arithmetic to JavaScript, replacing the error-prone Date object that silently clamps dates incorrectly.
Adding one month always adds exactly 30 days.
Months have 28, 29, 30, or 31 days. Adding one month means advancing the month component, not adding 30 days. January 15 + 1 month = February 15, not February 14.
Every 4 years is a leap year.
The full Gregorian rule is: divisible by 4 AND (not divisible by 100 OR divisible by 400). So 1900 was NOT a leap year, but 2000 was. The next century-exception is 2100.
Business day rules are universal.
Business days are MonβFri minus public holidays β and public holidays are jurisdiction-specific. What is a business day in New York may be a holiday in London, limiting cross-border deadline calculation.
Time zones don't matter when adding days.
Date Calculator
Days, months, years between two dates
Age Calculator
Calculate your exact age in years, months, days
Hours Calculator
Track work hours and compute pay
Task Prioritizer
Rank tasks by urgency and impact
Unit Converter
Convert time and 100+ other units
Tip Calculator
Split restaurant bills and tips
Calculators for finance, health, math, engineering, and more β all free.
Browse All Tools βLast updated:
function isLeapYear(year) {
return (year % 4 === 0
&& year % 100 !== 0)
|| (year % 400 === 0);
}
// Examples:
// 2024 β true (div by 4)
// 1900 β false (div by 100, not 400)
// 2000 β true (div by 400)The Gregorian calendar adds one leap day every 4 years, skips every 100, then adds it back every 400. This keeps the calendar aligned with the solar year to within 26 seconds/year.
| Apr 30 |
| April has only 30 days |
| Feb 28 | + 1 day (leap year) | Feb 29 | Feb 29 | Valid β leapyear has Feb 29 |
* Feb 28 if common year; Feb 29 if leap year. Clamping to the last valid day of the target month is the ISO 8601 and RFC 5545 convention.
The iCalendar standard formalized recurrence rules (RRULE), including business day and exclusion date handling, enabling calendar software interoperability.
TC39 began work on the Temporal API to replace JavaScript's broken Date object, bringing correct ISO 8601 arithmetic, time zones, and calendar systems to web browsers.
They do when near DST transitions. Adding 1 day at 1:30 AM on a 'spring forward' night may produce unexpected results. Use UTC or date-only arithmetic (no time component) for pure day addition.