HomeGuides Date Math: Days Between Dates, Age & Weekdays

Date Math: Days Between Dates, Age & Weekdays

Date arithmetic looks simple until months of different lengths and leap years get involved. Here are the reliable ways to count days between dates, work out an age, find a weekday, and count only working days.

Days between two dates

The safe method is to convert each date to a day count from a fixed reference and subtract — which is exactly what a computer does internally. Counting by hand across months invites off-by-one errors, especially around month ends. Decide up front whether you count both endpoints or just one: "from the 1st to the 5th" is four days if you count the gaps, five if you count the days themselves.

Adding and subtracting days

To add days, roll over month and year boundaries carefully: 20 days after the 25th of a 30-day month lands on the 15th of the next month. Adding months is trickier because of unequal lengths — one month after 31 January has no clean answer, which is why tools define a rule. The Date Difference and Days-Until calculators handle the rollovers for you.

Working out an exact age

Age is not just this year minus the birth year — it depends on whether the birthday has happened yet this year. The reliable method: take the year difference, then subtract one if today is earlier in the year than the birthday. That is how an Age Calculator reports the correct years, months and days.

Leap years and weekdays

A leap year adds 29 February. The rule: divisible by 4, except centuries, unless divisible by 400 — so 2000 was a leap year but 1900 was not. Because 365 is not a whole number of weeks, the weekday of a fixed date drifts forward by one each year (two across a leap year), which is why your birthday lands on a different day annually.

Frequently asked questions

How do I count only working days? Count the total days, then subtract weekends and any holidays in the range — a Business Days calculator automates it.

Why is my age off by a day? Usually a timezone or endpoint issue — whether the birthday counts as reached at midnight local time.

Is a year always 365 days? No — leap years have 366, which is what trips up naive date math.

Related tools

Last updated: August 27, 2026