How to Calculate the Number of Days Between Two Dates

Key Takeaways

  • Calculating the number of days between two dates means counting every full day from the earlier date to the later date, not simply subtracting the day-of-month numbers.
  • The most reliable manual method uses the Julian day number or a running day-count approach, adding up the days remaining in each month along the way.
  • Leap years add an extra day to any range that includes February 29, and forgetting to check for this is the single most common source of manual calculation errors.
  • Whether the start and end dates are inclusive or exclusive changes the final count by exactly one day, and different tools handle this differently, so it’s worth checking which convention applies.
  • You can get an instant, exact result for any two dates, or calculate age from a date of birth instead, using our free age calculator.

Why This Calculation Comes Up So Often

Counting the days between two dates seems like it should be simple subtraction, but the calendar doesn’t cooperate. Months have different lengths, years occasionally have an extra day, and people frequently need this calculation for very different purposes: figuring out how many days until a deadline, calculating someone’s exact age in days, determining a rental or subscription period, or working out how long ago a historical event occurred.

Because the underlying need is so common, and because manual counting is genuinely easy to get slightly wrong, it’s worth understanding the method properly rather than relying on a rough mental estimate.

Method 1: The Running Total Approach

This is the most intuitive manual method, and it works well for date ranges within a year or two.

StepWhat to do
1Identify the earlier date (start) and the later date (end)
2Count the remaining days in the start month, from the start date to the end of that month
3Add the full number of days in every month that falls completely between the start and end months
4Add the day-of-month number of the end date
5Check whether any month in the range is February in a leap year, and adjust that month’s day count accordingly
6Total everything for the final day count

Worked Example: Standard Case, Same Year

How many days are there from March 10 to June 18 in a non-leap year?

  • Remaining days in March after March 10: 31 − 10 = 21 days.
  • Full months in between: April (30 days) and May (31 days) = 61 days.
  • Days into June up to June 18: 18 days.
  • Total: 21 + 61 + 18 = 100 days.

Worked Example: Edge Case, Spanning a Leap Year’s February

How many days are there from January 15 to March 15, in a leap year?

  • Remaining days in January after January 15: 31 − 15 = 16 days.
  • Full month in between: February, which has 29 days in a leap year.
  • Days into March up to March 15: 15 days.
  • Total: 16 + 29 + 15 = 60 days.

In a non-leap year, the same date range would total 59 days instead, a one-day difference that comes entirely from February’s length. This is exactly the kind of detail covered in more depth in our guide on how leap years affect your age calculation.

Method 2: The Julian Day Number Approach

For date ranges spanning multiple years, or for anyone who wants a more systematic method, the Julian day number approach is more reliable than manually tallying months.

Every calendar date can be converted into a single sequential number, the Julian day number, representing the number of days that have elapsed since a fixed reference point. To find the number of days between two dates, convert both to their Julian day numbers and subtract.

StepWhat to do
1Convert the start date to its Julian day number
2Convert the end date to its Julian day number
3Subtract the start’s Julian day number from the end’s
4The result is the exact number of days between the two dates

This method is what most software date libraries and calculators use internally, since it avoids the accumulation of small errors that can creep into manual month-by-month counting across multiple years and multiple leap years. It’s more mathematically involved to do by hand than the running total method, which is exactly why a calculator is worth using for anything spanning several years.

Inclusive vs. Exclusive Date Ranges

One detail that trips up even careful manual counters: whether the start date, the end date, or both are included in the count.

ConventionDescriptionExample (Jan 1 to Jan 10)
Exclusive of both endpointsCounts only the full days strictly between the two dates8 days
Inclusive of the end date only (most common for “days between”)Counts from the day after the start date through the end date9 days
Inclusive of both endpointsCounts both the start date and the end date as full days10 days

Most everyday uses of “days between two dates,” such as calculating age in days or the length of a rental period, use the “inclusive of the end date only” convention, but this isn’t universal. If a number of days matters for a contract, deadline, or legal requirement, it’s worth explicitly confirming which convention applies rather than assuming.

Calculating in the Other Direction: Days Until a Future Date

The same method works in reverse for calculating how many days remain until a future date, simply by treating today as the start date and the target date as the end date. This is functionally the same calculation as counting days between two past dates, just applied to a date that hasn’t happened yet. The same leap year and inclusive/exclusive considerations apply either way.

Manual Counting vs. Using a Calculator

FactorManual CountingDate Calculator
Short ranges within a single yearManageable with the running total methodInstant and exact
Ranges spanning multiple yearsRequires careful tracking of every month and leap year in betweenHandled in one step
Leap year adjustmentsEasy to forget, especially for years that aren’t obviously round numbersApplied automatically using the full leap year rule
Inclusive vs. exclusive countingEasy to apply inconsistently without realizing itCan be set explicitly and applied consistently
Good for a single quick checkFineFine
Good for legal, financial, or medical deadline calculationsRisky without careful double-checkingMore reliable

Common Mistakes

MistakeWhy It’s WrongThe Fix
Simply subtracting day-of-month numbers (e.g. 18 − 10 = 8)Ignores which months are involved and their actual lengths entirelyUse the running total or Julian day number method to properly account for month lengths
Assuming every month contributes 30 days to the totalProduces errors of one to two days per month, since actual month lengths range from 28 to 31 daysAdd up the actual day counts of each specific month in the range
Forgetting to check whether a leap year falls within the rangeProduces a one-day error for every leap year February included in the countCheck each year in the range against the full leap year rule before finalizing the count
Not clarifying inclusive vs. exclusive countingProduces a result that’s off by exactly one day compared to what the other party expectsExplicitly state or confirm which convention is being used, especially for contracts or deadlines
Manually tracking Julian day numbers without double-checking the conversionSmall arithmetic slips compound across the conversion stepsUse a calculator for any range spanning multiple years or leap years

Frequently Asked Questions

How do I calculate the number of days between two dates by hand? Count the remaining days in the start month, add the full length of every month in between, then add the day-of-month of the end date, adjusting for leap years as needed.

Does the count include both the start and end date? It depends on the convention used. Most everyday calculations include the end date but not the start date, but this isn’t universal, so it’s worth confirming for anything with legal or financial stakes.

How do leap years affect this calculation? Any date range that includes a February 29 adds one extra day to the total compared to the same range in a non-leap year.

What’s the difference between this and calculating someone’s age? Calculating age typically converts a day count into years, months, and days, while this calculation gives a single total number of days. Age calculations rely on the same underlying date-difference math.

Can I calculate days between two dates in different years? Yes, the same method applies, it just requires tracking more months and potentially more leap years across the range.

What’s the most accurate manual method for long date ranges? The Julian day number method, since it avoids the accumulation of small errors that can occur when manually tallying many individual months.

How do I calculate how many days until a future date? Use the same method, treating today’s date as the start date and the future date as the end date.

Is there a faster way to check this than doing the math by hand? Yes, our free age calculator can calculate the exact number of days between any two dates, or calculate age from a date of birth instead, in a single step.

A Note on Method

This guide follows standard Gregorian calendar date arithmetic, including the full leap year rule, for all calculations. For the related question of how age and date of birth relate to each other, see what is the difference between age and date of birth. For a deeper look at why month lengths vary in the first place, see how many days are in each month and why.

Leave a Reply

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