How many days between two dates? What date is 30 days from now? Common but easy to miscount — let this handle it.
Dates are irregular by construction, so a "add 30 days" rule and an "add one month" rule give different answers. Three cases cause most of the confusion:
| Test | Result |
|---|---|
| Divisible by 4 | Leap year (366 days) |
| Divisible by 100 | Not a leap year — 1900 was not |
| Divisible by 400 | Leap year after all — 2000 was |
So 2024 and 2028 are leap years, 2100 will not be, and 2000 was. The rule keeps the calendar aligned with the solar year to within about one day in 3,300 years.
A week is unambiguous. A month is 28 to 31 days, and a year is 365 or 366, so converting between them always needs a convention. If you are computing a deadline or a payment schedule, decide whether you mean calendar months or 30-day blocks, and say which in the contract.
Skipping weekends shortens a period by roughly 2/7. Public holidays shorten it further, and they are jurisdiction-specific and move every year, so they cannot be baked into a simple formula. Anything with a legal deadline should be counted in business days against a published holiday list.