How to Calculate Days Between Two Dates
Counting the days between two dates seems like it should be trivial, and yet it is the source of missed deadlines, disputed invoices and late fees. The difficulty is not arithmetic — it is that the question “how many days?” is genuinely ambiguous, and different people answer it differently. This guide explains the traps, how to count correctly, and why the answer sometimes legitimately depends on who is asking.
The inclusive vs. exclusive trap
Start here, because this single ambiguity causes more errors than everything else combined.
How many days are there from Monday to Wednesday?
- Two — if you count the gaps between the days. Monday to Tuesday is one, Tuesday to Wednesday is two. This is exclusive counting.
- Three — if you count the days themselves: Monday, Tuesday, Wednesday. This is inclusive counting.
Both are correct. They answer different questions. And the difference of one day is exactly what turns a payment into a late payment.
Which one you want depends on what you are measuring:
- Duration— “how long until the deadline?” → exclusive. The gap.
- Occupancy or attendance— “how many days was I in hospital?”, “how many days is the conference?” → inclusive. You count both ends.
A hotel is the perfect illustration of why this confuses people. Check in on the 10th, check out on the 13th: you were present on four calendar days, but you are billed for three nights. The hotel counts the gaps, not the days.
Practical advice:when a contract or a form says “within 30 days,” find out whether day one is the day of the event or the day after. It is a fair question, and asking it has saved a lot of people a lot of money.
Why manual counting goes wrong
The naive approach — count the days left in the first month, add the whole months, add the days in the last month — fails because months are irregular. You must remember that:
- Seven months have 31 days, four have 30, and February has 28 or 29.
- Leap days appear on an irregular schedule.
- Spans crossing a year boundary invite off-by-one errors.
For a span of a few days you can count on your fingers. For anything crossing a month boundary, people miscount surprisingly often — and confidently.
How computers do it (and why it always works)
The reliable method is elegant: convert both dates to a single number, then subtract.
Computers store a date as the count of days (or seconds) since a fixed reference point — commonly 1 January 1970, known as the Unix epoch. Once both dates are just numbers on that single continuous line, the difference between them is plain subtraction. All the irregularity of months and leap years is already baked into the conversion.
This is why a date calculator is trustworthy in a way that mental arithmetic is not: it never has to remember how many days June has.
Leap years
Any span crossing 29 February gains an extra day, and it is easy to forget. The rule is subtler than most people recall:
- Divisible by 4 → leap year…
- …unless divisible by 100 → not a leap year…
- …unless divisible by 400 → leap year after all.
So 2000 was a leap year, but 1900 was not — an exception that quietly broke a lot of software.
Business days are a different question
“Payment due in 30 days” and “payment due in 30 businessdays” are wildly different promises. Thirty business days is about six weeks of calendar time.
Counting business days means excluding weekends — and public holidays, which is where it gets genuinely hard, because holidays differ by country, and sometimes by region within a country. There is no universal calendar. Any tool that claims to count business days must be told which holiday calendar to apply.
A rough approximation: business days ≈ calendar days × 5/7, then subtract any holidays in the range. Good enough for planning, not for a contract.
The other units
Once you have the day count, other units follow — but be careful about what they mean:
- Weeks = days ÷ 7. Clean and unambiguous.
- Months — ambiguous. Is a month 30 days? 30.44 on average? Or a calendar month, so that 31 January plus one month is… 28 February? Different systems answer differently.
- Years = days ÷ 365.2425, on average. But for an exact age you should compare calendar dates, not divide.
Days are the only unit with no ambiguity at all — which is exactly why contracts are written in days.
Common uses
- Deadlines and notice periods — contracts, resignations, rental notice.
- Invoice terms — net 30, net 60, and calculating late-payment interest.
- Project planning — working out how much time actually remains.
- Countdowns — days until a wedding, a trip, an exam.
- Visas and permits, which often limit stays to a precise number of days.
- Anniversaries and milestones — how many days you have been together, or alive.
Common mistakes to avoid
- Not establishing inclusive vs. exclusive before you start.
- Forgetting a leap day in a span crossing February.
- Assuming every month is 30 days.
- Mixing up calendar days and business days.
- Ignoring time zonesfor deadlines that fall at a specific hour — “end of day” in which city?
Frequently asked questions
Should I count both the start and end date? Only if you are measuring occupancy or attendance. For a duration or a deadline, count the gap — exclusive.
How many days are in a year exactly? 365, or 366 in a leap year. The long-run average is 365.2425.
How do I count business days? Exclude weekends, then subtract the public holidays that apply in your country.
Why does my answer differ from someone else's by one day? Almost certainly the inclusive/exclusive question. You are both right; you are answering different questions.
Calculate the difference now
Use our Date Difference Calculator to count the days between any two dates — leap years handled correctly, instantly, and entirely in your browser. To work out an exact age instead, use the Age Calculator, and see our guide on calculating your exact age. Working with timestamps in code? The Epoch Converter turns dates into Unix time.