- Home
- Date & Calendar Math
Date & Calendar Math
Date & Calendar Math covers arithmetic that has to reckon with the actual shape of the Gregorian calendar: months of different lengths, a leap day that shows up once every four years (mostly), weeks that do not divide evenly into months, and quarters that start on different dates depending on which fiscal convention applies. A date difference, an offset, a weekday lookup, or a "which quarter is this" question all live here.
Why calendar-month addition is not just "add 30 days"
Adding one calendar month to January 31 has no single obviously correct answer, because February does not have 31 days. WhenMath's default is to constrain the result to the last valid date of the target month (January 31 plus one month lands on February 28, or February 29 in a leap year), with an alternative "preserve end-of-month" rule available where it matters, and the choice always stated in the result rather than assumed silently. A calendar month and a fixed 30-day span are treated as genuinely different questions, because they usually produce different dates.
Inclusive counting is a choice, not a default
Counting the days "between" two dates can mean including both endpoints, excluding both, or (the convention used unless stated otherwise) excluding the start and including the end. The same two dates can produce three different correct-looking numbers depending on which rule is used, so every date-difference result says which one it applied.
Where to go next
Once weekends and holidays need to be excluded from a calendar span, see Business Days & Work Calendar. Once a date result needs to feed into a deadline or plan, see Deadlines & Project Capacity.
Date & Calendar Math tools
- Date Difference CalculatorFind both the elapsed day count and the calendar period between two dates.
- Add / Subtract Calendar TimeMove a date by calendar years/months/weeks/days or by fixed days.
- Date Midpoint CalculatorFind the date exactly halfway between a start and an end date.
- Date Range SplitterDivide a date range into a chosen number of equal-length segments.
- Inclusive vs Exclusive Date CounterSee all four ways to count days between two dates side by side.
- Weekday Count in Date RangeCount how many of each weekday fall within a date range.
- Calendar Month vs Fixed Days ComparatorSee how +1 month, +30 days, and +4 weeks diverge from the same date.
- Month-End Roll CalculatorCompare the constrain, preserve-EOM, and reject month-end rules side by side.
- Leap-Day Span CalculatorFind every February 29 within a date range using the full Gregorian rule.
- Multi-Date Offset CalculatorApply one calendar offset to a list of 2-50 dates and compare every result.
- Day-of-Week CalculatorFind what day of the week any date falls on.
- Day-of-Year CalculatorFind a date's ordinal day of the year and how many days remain.
- Week Number CalculatorFind the ISO 8601 week number and week-year for any date.
- Weeks-in-Year CalculatorFind whether an ISO year has 52 or 53 weeks.
- Nth Weekday of Month CalculatorFind the date of, for example, the third Monday of a month.
- Last Weekday of Month CalculatorFind the last occurrence of a given weekday in a month.
- Quarter Start / End CalculatorFind the calendar quarter a date falls in, and its start/end dates.
- Fiscal Quarter CalculatorMap a date to a fiscal quarter for a custom fiscal-year start month.
- Calendar Composition CalculatorCount weekdays and weekend days in a month, with a custom weekend.