Date maths is harder than it looks
· 5 min read
Counting the days between two dates feels like it should be the easiest calculation on any site. It is quietly one of the fiddliest, and almost every disagreement about the answer comes down to one of three things.
Inclusive or exclusive counting
From Monday to Wednesday — is that two days or three? Both answers are defensible and both are used in practice. Two is the elapsed duration. Three is the number of days involved, which is how hotel nights, hire periods and some contractual deadlines are counted.
Our days between dates calculator reports the elapsed count — the difference between the two dates. If a contract says “within 30 days”, check which convention it means before you rely on either number.
Months are not a fixed length, and neither are years
This is where age calculations go wrong. What is one month after the 31st of January? There is no 31st of February, so the answer has to be a convention: most systems clamp to the last valid day, giving the 28th or 29th.
String enough of those clamps together and naive arithmetic starts producing negative day counts — the classic symptom of an age calculator that subtracts years, then months, then days without checking whether it has borrowed correctly. Our age calculator walks forward from the birth date one clamped anniversary at a time, which is slower and gives the right answer.
Leap years add the rest. A person born on the 29th of February has a real birthday three years in four only if you take the date literally, which is why different jurisdictions disagree about when they legally turn eighteen.
Working days need a calendar we do not have
Excluding weekends is arithmetic: it depends only on which day of the week you start. Excluding holidays is not, because it depends on where you are and who you work for.
Federal holidays differ from state holidays. Many countries have regional ones. Some move when they fall on a weekend and some do not. Plenty of employers observe days that no government does.
So our business days calculator excludes weekends and tells you, on the page, that it does not know your holidays. A tool that silently applied one country’s holiday list would be wrong for most of the people using it and would never say so — which is worse than being narrow and honest.
