Blog

How to Calculate the Days Between Two Dates

By Ammad Humayun ·

Illustration of a calendar with two dates marked☷

Counting days sounds trivial until a deadline, a leap year or the question of whether to count the first day gets involved. Here is a method that holds up.

The number of days between two dates depends on a question nobody asks out loud: are you counting the days in between, or the days including both endpoints? From 1 March to 5 March is four days of elapsed time and five days if you count both dates. Both answers are correct for different questions, and the disagreement causes more errors than the arithmetic does.

Inclusive versus exclusive

Hotels count nights, which is the exclusive method. Rental agreements, leave entitlements and notice periods vary, and the answer is in the wording of the agreement rather than in the calendar. When a contract says 'within 30 days', the question of whether day one is the date of the event or the day after is a legal detail, not an arithmetic one.

QuestionMethod1 Mar to 5 Mar
How many days until?Exclusive: end - start4 days
How many days is the trip?Inclusive: end - start + 15 days
How many nights?Exclusive: end - start4 nights
How many days am I charged for?Depends on the contract4 or 5

Counting by hand

From 14 March to 22 June in a non-leap year: 17 days left in March (31 - 14), plus April's 30, plus May's 31, plus 22 days in June. That is 17 + 30 + 31 + 22 = 100 days, exclusive.

Month lengths are the only thing to have in front of you: 31 days for January, March, May, July, August, October and December; 30 for April, June, September and November; and 28 or 29 for February.

  1. Count the days remaining in the starting month after the start date.
  2. Add the full number of days in each complete month in between.
  3. Add the day number of the end date.
  4. Add one at the end only if you need an inclusive count.

Leap years

A year is a leap year if it is divisible by 4, except century years, which must be divisible by 400. So 2024 and 2028 are leap years, 1900 was not, and 2000 was.

In practice this only matters if your range crosses 29 February. Spanning that date adds one day, and a range that crosses several Februaries needs one extra day for each leap year included.

The century rule is genuinely rare — the next exception is 2100 — but it is the reason a naive 'divisible by four' check produces spreadsheets that are wrong once a century.

Counting business days

Across 100 days: 14 complete weeks is 98 days, giving 70 weekdays, plus the remaining 2 days counted individually. If both are weekdays, that is 72, minus any weekday holidays.

Public holidays are the part that cannot be generalised. They differ by country, and often by region within a country, and a business-day calculation that ignores them will be wrong at exactly the times of year when deadlines cluster.

  1. Find the total number of days between the dates.
  2. Divide by 7 to get complete weeks, and multiply that by 5 for the weekdays in them.
  3. Count the weekdays in the remaining partial week by hand.
  4. Subtract any public holidays that fall on a weekday inside the range.

Where this comes up

Daily interest is the case where the inclusive-exclusive choice has a direct monetary consequence. On a large balance, one extra day of interest is a real amount, and lenders specify a day-count convention precisely because the ambiguity is worth money.

  • Payment terms. Net 30 from an invoice date determines when a payment is actually late.
  • Notice periods for a lease, employment or a subscription cancellation.
  • Interest that accrues daily, where the day count directly determines the amount.
  • Age calculations, warranty periods and eligibility dates.
  • Project planning, where business days and calendar days give very different end dates.
  • Travel, where nights and days differ by one and booking systems count nights.

Counting errors that shift the day total

  1. Assuming a month is 30 days. Only four are, and 'in 30 days' rarely lands on the same date next month.
  2. Forgetting 29 February when the range crosses it.
  3. Mixing calendar days and business days within one calculation.
  4. Ignoring public holidays, especially across a border where the calendar differs.
  5. Getting the inclusive-exclusive decision wrong by one, which is almost always the source of an answer that is off by exactly one day.
  6. Overlooking time zones when both dates carry a time, which can shift a count by a full day.

Assumptions and limitations

Every method above assumes the Gregorian calendar and ignores time of day. Two timestamps 23 hours apart can fall on different calendar dates, and two timestamps 25 hours apart can fall on the same one. If the time matters, calculate in hours and convert.

Business-day counting assumes a Monday-to-Friday week, which does not hold everywhere. In several countries the working week runs Sunday to Thursday, so a calculation built on a weekend assumption will be wrong from the start.

And a hand calculation cannot know which holidays apply to the parties involved. For anything with a legal or financial deadline, confirm the day-count convention in the agreement rather than assuming the ordinary one — contracts routinely define terms like 'business day' explicitly, precisely because the default is ambiguous.

Decide what 'between' means first

Date calculations often disagree because people use different counting conventions. Decide whether the start date is excluded, whether the end date is included, and whether you need calendar days or business days. Write the convention beside the result. For planning deadlines, that one line can prevent an otherwise correct calculation from being used one day early or late.

Frequently asked questions

How many days are in a year for calculation purposes?

365, or 366 in a leap year. Some financial conventions use 360 days with 30-day months, which simplifies interest arithmetic and produces slightly different results from a true day count.

Does 'within 30 days' include the starting day?

Usually not — the count typically begins the day after the triggering event — but this varies by jurisdiction and by contract. Check the wording, since the difference is a full day of compliance.

How do I count days across a leap year boundary?

Count normally and add one extra day for each 29 February that falls inside the range.

Why do two date calculators give different answers?

Almost always because one counts inclusively and the other exclusively. Check whether each treats the end date as counted or as the boundary.

Why can two date calculators give different answers?

They may use different inclusive or exclusive counting rules. The dates can be identical while the definition of the interval differs.

Do leap years matter?

Yes. A leap day adds one calendar day to intervals that cross February 29, so the actual dates should be used rather than assuming every year has 365 days.

Conclusion

Decide first whether you need an inclusive or exclusive count, because that single choice explains most disagreements between two answers that are otherwise both correct. Then count the days remaining in the first month, the full months between, and the days in the last month, adding one for each leap day crossed. For business days, work out the weekdays and subtract holidays that genuinely apply where the deadline sits.

Written by Ammad Humayun
Ammad Humayun writes the calculation guides on this site, using stated formulas and worked examples. If you spot an error or an unclear step, please tell us and we will check it against the formula.

Figures in this article are illustrative. Results depend on your own rates, fees, taxes and circumstances, and are for educational and planning purposes rather than financial advice.

Related articles

← Back to Blog