Calendar Date Decrementer
Subtract days, weeks, months, or years from any calendar date. Get precise past dates with day-of-week, leap year handling, and full calculation history.
About
Subtracting time from a calendar date is not simple addition in reverse. Month lengths vary between 28 and 31 days. Leap years insert an extra day every 4 years, except centuries not divisible by 400. Decrementing March 31 by one month does not yield February 31 because that date does not exist. This tool handles end-of-month clamping, leap year boundaries, and BCE/CE transitions correctly. Errors in manual date arithmetic cause missed deadlines, incorrect contract terms, and compliance failures in legal or financial contexts.
The calculator operates on the proleptic Gregorian calendar. It applies native date rollover logic for day and week subtraction. For month and year subtraction, it clamps the day component to the last valid day of the resulting month. All results include the day of week, the ISO 8601 week number, and the exact span between the original and resulting date. Note: this tool assumes the Gregorian calendar throughout. Dates before October 15, 1582 are extrapolated, not historically accurate for Julian-calendar regions.
Formulas
For day and week subtraction, the tool computes a direct offset on the day component:
where Dstart is the starting date, n is the decrement amount, and k = 1 for days or k = 7 for weeks. The native Date object handles month/year rollover automatically.
For month subtraction with end-of-month clamping:
dresult = min(dstart, daysInMonth(ynew, mnew))
where daysInMonth returns the number of days in the target month, accounting for leap years. This prevents invalid dates like February 30.
Leap year determination follows the Gregorian rule:
The ISO 8601 week number is computed by finding the Thursday of the result date's week, then counting weeks from January 1 of that Thursday's year.
Reference Data
| Month | Days | Cumulative (non-leap) | Cumulative (leap) | Notes |
|---|---|---|---|---|
| January | 31 | 31 | 31 | Start of Gregorian year |
| February | 28/29 | 59 | 60 | Leap day added here |
| March | 31 | 90 | 91 | Equinox month |
| April | 30 | 120 | 121 | - |
| May | 31 | 151 | 152 | - |
| June | 30 | 181 | 182 | Solstice month |
| July | 31 | 212 | 213 | Named after Julius Caesar |
| August | 31 | 243 | 244 | Named after Augustus |
| September | 30 | 273 | 274 | Equinox month |
| October | 31 | 304 | 305 | Gregorian adoption (1582) |
| November | 30 | 334 | 335 | - |
| December | 31 | 365 | 366 | Solstice month |
| Leap Year Rules (Gregorian) | ||||
| Divisible by 4 | Leap year - unless century year | |||
| Divisible by 100 | Not a leap year - unless also divisible by 400 | |||
| Divisible by 400 | Leap year (e.g., 2000) | |||
| ISO 8601 Day-of-Week Numbering | ||||
| Monday | 1 | ISO week starts on Monday | ||
| Tuesday | 2 | - | ||
| Wednesday | 3 | - | ||
| Thursday | 4 | Determines ISO week-numbering year | ||
| Friday | 5 | - | ||
| Saturday | 6 | - | ||
| Sunday | 7 | - | ||