How Date and Time Calculations Actually Work
Why calculating someone's age isn't just subtraction, and how business day and leap year calculations handle real calendar quirks.
Date math looks trivial until you actually try to write it — calendars have irregular month lengths, leap years, and weekends that break naive "just subtract the numbers" approaches.
Why age isn't simply "this year minus birth year"
If you were born in December and it's currently January, subtracting birth year from the current year overstates your age by one — you haven't had your birthday yet this year. Correct age calculation compares the full date: subtract years, then check whether the current month/day has passed the birth month/day yet, borrowing a year if not. Someone born January 1, 1990 turns exactly 36 years and 6 months and 20 days old on July 21, 2026 — not simply "2026 minus 1990."
Date differences: exclusive, not inclusive
Calculating the days between two dates (say, January 1 and December 31 of the same non-leap year) gives 364 days, not 365 — because the difference is exclusive of one endpoint. This trips people up constantly when calculating things like hotel nights (checking in on the 1st and out on the 5th is 4 nights, not 5) or contract durations.
Leap years: not just "every 4 years"
The actual rule has three layers: a year is a leap year if divisible by 4, except century years, unless they're also divisible by 400. That's why 2000 was a leap year but 1900 was not, despite both being divisible by 100 — 2000 is also divisible by 400, and 1900 isn't. This three-tier rule keeps the calendar aligned with Earth's actual orbital period (365.2422 days, not exactly 365.25).
Business days: subtracting weekends, not holidays
A "business days" calculation counts only Monday through Friday between two dates — it does not account for public holidays unless explicitly programmed to, since holidays vary by country and even by industry. A calendar month like July 21 to August 21, 2026 contains 31 total days but only 24 business days once weekends are excluded — always double-check whether "business days" in a contract or deadline also excludes holidays in your specific jurisdiction.
ISO week numbers
The ISO 8601 week-numbering system defines week 1 as the week containing the year's first Thursday, with weeks running Monday to Sunday — which is why the "week number" of an early-January date can sometimes belong to the previous year's numbering, a frequent source of off-by-one bugs in scheduling software.
- The age calculator and age in days calculator handle the "not just subtraction" logic above
- The date difference calculator and business days calculator handle exclusive-date and weekend-exclusion math
- The leap year checker and week number calculator cover the two calendar-rule edge cases above