How to Calculate the Number of Days Between Two Dates

How many days until your holiday? How long has it been since that project started? How many days are left on a visa, a subscription, or a deadline? Sooner or later, everyone needs to know how to calculate number of days between two dates — and most people get it wrong by exactly one day.

That one-day error is so common it has a name among spreadsheet users: the off-by-one. It happens because counting days isn’t like counting apples. There are two endpoints, and you have to decide — before you start — whether you’re counting one of them, both of them, or neither.

The good news is that you don’t need an app for this. This guide shows you how to calculate number of days between two dates three different ways: counting month by month (the easiest to follow), the borrowing method (the one that gives you years, months and days), and the ordinal-day shortcut (the fastest once you know it). Below, each one is explained with a fully worked example using real dates, plus the leap-year trap that catches even careful counters, a 30-second spreadsheet method, and the mistakes to avoid. And if you just want the answer instantly, our date difference calculator does the whole thing — days, weeks, hours, minutes and seconds — in one click.

The One Rule First: Agree on What You’re Counting

Before a single subtraction, settle the convention: exclude the start date, include the end date. That’s how most calculators, spreadsheets and date tools work, and it’s the convention this whole guide uses.

Why does it matter? Take a simple case: from Monday to Tuesday. If you count both days, you get two — but only one day has actually passed. If you count neither, you get zero, which is clearly wrong. Excluding the start and including the end gives one, which matches reality: one day elapsed between Monday and Tuesday.

Think of it like a train journey. The departure station isn’t part of the distance travelled; the arrival station is where you stop counting. Once you fix that rule, every method below gives the same answer — and your hand count will match what Excel, Google Sheets and online calculators return.

One more habit worth adopting: always write your dates in the same format, ideally year-month-day (2026-11-18). It removes the classic 03/04 confusion — is that 3 April or 4 March? — which has ruined more than one deadline calculation.

Method 1: Count Month by Month

This is the method to reach for when the two dates are in the same year and fairly close together — the most intuitive way to learn how to calculate number of days between two dates. It needs no formula at all — just the lengths of the months.

The steps:

  1. Count the days left in the start month (the month’s total days minus the start day).
  2. Add the full months in between, using each month’s real length.
  3. Add the days in the end month.

Worked Example 1: How Many Days Until New Year’s Eve?

Today is 18 November 2026. How many days until 31 December 2026?

  • Step 1 — November remaining: November has 30 days, so 30 − 18 = 12 days left in November.
  • Step 2 — Full months in between: December is the end month, so there are no full months between. (If the end date were in January, December’s 31 days would go here.)
  • Step 3 — Days in December: the end date is 31 December, so add 31 days.

Total: 12 + 31 = 43 days.

That’s the answer: 43 days from 18 November to 31 December 2026. If you’d rather think in weeks, 43 ÷ 7 = 6 weeks and 1 day. In hours, it’s 43 × 24 = 1,032 hours.

Notice what makes this method reliable: you never have to remember a formula, and each step uses a real month length. The only thing you need is the list of month lengths — 31, 28 (or 29), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 — and the old knuckle trick still works if your memory slips.

Method 2: How to Calculate Number of Days Between Two Dates in Years, Months and Days

Month-by-month counting gets tedious when the dates are years apart. For that, use the borrowing method — the same subtraction-with-borrowing you learned in primary school, applied to dates. It’s also the method our guide on how to calculate age uses, because age is really just a date difference expressed in years, months and days.

The steps:

  1. Subtract the days. End day minus start day. If the result is negative, borrow one month: add the number of days in the month before the end month, then subtract. Remember you owe the months column one month.
  2. Subtract the months. End month minus start month (minus one more if you borrowed in Step 1). If the result is negative, add 12 and remember you owe the years column one year.
  3. Subtract the years. End year minus start year (minus one more if you borrowed in Step 2).
  4. Read the answer as years, months, days.

Worked Example 2: A Three-Year Gap

From 5 November 2023 to 13 November 2026 — how long is that?

  • Step 1 — Days: 13 − 5 = 8 days. Positive, no borrowing needed.
  • Step 2 — Months: 11 − 11 = 0 months. No borrowing.
  • Step 3 — Years: 2026 − 2023 = 3 years.

Answer: 3 years, 0 months, 8 days — or 1,104 days in total (the 2024 leap year contributes 366 days, plus two ordinary years of 365, plus 8 days).

Now try a case that forces borrowing, because that’s where the method earns its keep. From 5 November 2023 to 23 October 2026:

  • Step 1 — Days: 23 − 5 = 18 days.
  • Step 2 — Months: 10 − 11 = −1. Negative, so borrow a year: 10 + 12 − 11 = 11 months. (The years column now owes one.)
  • Step 3 — Years: 2026 − 2023 − 1 = 2 years.

Answer: 2 years, 11 months, 18 days. You can sanity-check it by adding back: 2 years after 5 November 2023 is 5 November 2025; add 11 months and you reach 5 October 2026; add 18 days and you land exactly on 23 October 2026. When your answer reconstructs the end date like that, the arithmetic is right.

The detail that trips people up is Step 1’s borrowing: you borrow the previous month’s actual length, not a flat 30 days. Borrowing in October means borrowing September’s 30 days; borrowing in March means borrowing February’s 28 (or 29 in a leap year). Get that right and the method never fails.

Method 3: The Ordinal-Day Shortcut

If you want the fastest way to work out how to calculate number of days between two dates by hand, convert each date to its “ordinal day” — its day-of-year number — and subtract. It’s the method programmers and calendar nerds use, and once you’ve done it twice it feels like a magic trick.

The steps:

  1. Find each date’s day-of-year: add up the full months before it, then add the day number.
  2. Subtract the start date’s ordinal from the end date’s ordinal.
  3. If the dates are in different years, add 365 for each full year between them, plus one extra day for every 29 February crossed.

Here’s the cumulative month table for an ordinary (non-leap) year — the running total of days at the end of each month:

MonthDaysCumulative days at month end
January3131
February2859
March3190
April30120
May31151
June30181
July31212
August31243
September30273
October31304
November30334
December31365

(In a leap year, add 1 to every cumulative figure from March onwards, because February has 29 days.)

Worked Example 3: Days Since Mid-January

From 15 January 2026 to 13 November 2026:

  • Day-of-year of 15 January: 15 (January has no full months before it).
  • Day-of-year of 13 November: the cumulative total through October is 304, plus 13 = 317.
  • Subtract: 317 − 15 = 302 days.

That’s it — one subtraction. The same pair of dates by month-by-month counting would have taken ten additions. The ordinal method is also the easiest to double-check: if your day-of-year for a date in December comes out above 365 (or 366 in a leap year), something went wrong upstream.

The Leap-Year Trap

Here is the trap that quietly breaks date counts: 29 February only counts if it falls inside your date range.

Take 28 February 2024 to 1 March 2024. February 2024 had 29 days, so the count is 2 days — 29 February sits between the two dates and must be counted. But take the same two calendar dates in 2026, a non-leap year: 28 February 2026 to 1 March 2026 is just 1 day. Same month, same day numbers, different answer — because the leap day exists in one range and not the other.

The rule itself is simple, but it has a famous exception:

A year is a leap year if it is divisible by 4 — except century years, which are leap years only if divisible by 400.

So 2024 was a leap year and 2028 will be, but 1900 was not, and 2100 will not be — even though both are divisible by 4. The one century most people remember is 2000, which was a leap year because 2000 divides evenly by 400. If your range crosses a century boundary (say, 1899 to 1901), this exception is the difference between a right and a wrong answer.

When in doubt, the safest check is to ask: does my range include a 29 February? If it does, that day adds one to the total. If it doesn’t, leap years are irrelevant to your count — which is why most short ranges never need the rule at all.

How to Calculate Number of Days Between Two Dates in Excel and Google Sheets

For bulk work — a whole column of start and end dates — a spreadsheet beats hand counting every time. If you need to work out how to calculate number of days between two dates for a whole list of events, both Excel and Google Sheets have a purpose-built function:

=DAYS(end_date, start_date)

Put the start date in A2 and the end date in B2, then =DAYS(B2, A2) returns the day count, using exactly the exclude-the-start convention this guide uses. The older DATEDIF function does the same job with =DATEDIF(A2, B2, “D”), and it can also return the answer in months or years if you swap the “D” for “M” or “Y”.

One warning: DATEDIF is semi-hidden in Excel — it won’t autocomplete, though it works in every modern version. And if you ever see a spreadsheet answer that’s exactly one day more than your hand count, check whether the formula is adding 1 to include both endpoints (a common pattern in project plans, where both the first and last day of a task count as work days). That’s a different convention, not an error — but it must match the convention your audience expects.

You can cross-check any result with the timeanddate.com date duration calculator.

Where You’ll Actually Use This

Date differences show up in more places than most people realise:

  • Project deadlines. “Forty-three days to launch” is a plan; “sometime in December” is a wish. Counting the days turns a vague date into a schedule you can work backwards from.
  • Leave and visa counts. Annual leave balances, visa validity windows and notice periods are all measured in exact days — and an off-by-one can mean an overstay or a lost day of holiday.
  • Pregnancy and health tracking. Gestational age is counted in weeks from a known date, which is why working out a pregnancy due date starts with exactly this kind of day count. The same arithmetic underlies age calculations in years, months and days.
  • Interest and billing periods. Loans, late fees and pro-rated bills often charge per day. Knowing how to count the days lets you check the lender’s maths instead of taking it on trust.
  • Age in days. Milestones like “10,000 days old” are just a date difference with a party attached — and the ordinal method makes them a one-minute calculation.
  • Event countdowns. Weddings, exams, product launches: the countdown only feels real when the number is exact.

Common Mistakes to Avoid

  1. Counting both endpoints. Including the start and the end date adds a phantom day. Pick the exclude-start convention and stick to it.
  2. Forgetting 29 February. If your range crosses a leap day, the count is one higher than a naive month-sum suggests. Check the range, not just the years.
  3. Assuming every month is 30 days. That shortcut drifts by days over a multi-month range — and by a full week over a year. Use the real month lengths.
  4. Borrowing a flat 30 days in the borrowing method. Borrow the previous month’s actual length: 28 or 29 for February, 30 or 31 for the rest.
  5. Mixing up weeks and work-weeks. Seven days make a week; five make a work-week. “Six weeks” of leave is 42 calendar days, but only 30 working days — and payroll usually counts the latter.
  6. Mixing conventions mid-calculation. If a spreadsheet counts both endpoints and your hand count excludes the start, the answers will disagree by one and you’ll waste an hour looking for a mistake that doesn’t exist. Agree the convention first, every time.

Frequently Asked Questions

Do you count the start date when calculating days between two dates?

No — the standard convention is to exclude the start date and include the end date. From 13 November to 14 November is one day, not two. Most calculators, spreadsheets and date tools use this convention, so your hand count will match theirs.

How do leap years affect the count?

A leap year only changes your answer if 29 February falls inside your date range — then it adds one day. A year is a leap year if divisible by 4, except century years, which must be divisible by 400. So 2024 was a leap year, 2026 is not, and the next leap day is 29 February 2028.

What is the fastest way to calculate the number of days between two dates?

The ordinal-day method: convert each date to its day-of-year number (using the cumulative month table above), subtract, then add 365 per full year between the dates plus one for each leap day crossed. For dates in the same year it’s a single subtraction.

How is this different from calculating age?

It isn’t, really — age is a date difference expressed as years, months and days instead of total days. The borrowing method in this guide is the same one used to calculate age; if you want the age version with its own worked examples, see our guide on how to calculate age.

Why does Excel give one day more than my hand count?

Almost always a convention mismatch: the spreadsheet formula is counting both endpoints (start + 1, or an explicit +1), while your hand count excludes the start date. Check the formula — =DAYS(end, start) matches the exclude-start convention exactly.

Can I count only weekdays between two dates?

Yes, but not with the methods above — they count calendar days. The quick estimate is total days × 5/7, then adjust for where weekends fall. For an exact count, use the NETWORKDAYS function in Excel or Google Sheets, which skips Saturdays and Sundays (and holidays, if you list them).

Count It Once, Check It in Seconds

You now know how to calculate number of days between two dates three different ways: month-by-month counting for short ranges, the borrowing method when you want years, months and days, and the ordinal-day shortcut when you want the fastest answer. The leap-year rule and the spreadsheet method cover the edge cases, and the convention — exclude the start, include the end — keeps every method in agreement.

For everyday use, though, skip the arithmetic: our date difference calculator takes any two dates and returns the exact gap in years, months, days and weeks — plus the totals in hours, minutes and seconds — in one click. Try it against one of the worked examples above and see the numbers match. Bookmark it for the next deadline, visa form or countdown that needs an exact answer.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top