Counting days between two dates is a surprisingly common need β€” for project deadlines, age calculations, event planning, contract terms, loan periods, and more. While a calculator handles it instantly, understanding the underlying methods helps when you need to calculate on the fly or work with date data in spreadsheets and code.

Why Date Arithmetic Is Tricky

Months have different lengths (28, 29, 30, or 31 days). Leap years add a day every 4 years (with exceptions for century years). Time zones and daylight saving time complicate timestamp comparisons. These irregularities make manual date arithmetic error-prone.

The most reliable approach: convert dates to a common unit (days since a fixed reference point), subtract, and convert back.

β†’ Use our Days Between Calculator for instant, accurate results.

How to Calculate Days Between Dates Manually

For dates within the same year, count the day-of-year numbers:

Day Number = Sum of days in preceding months + day of month January: days 1-31 February: days 32-59 (or 32-60 in leap years) March: days 60-90 (or 61-91 in leap years) ...and so on

Example: Days between March 5 and October 15 (same year, non-leap):

March 5 = day 31 (Jan) + 28 (Feb) + 5 = day 64 October 15 = 31+28+31+30+31+30+31+31+15 = day 288 Difference = 288 βˆ’ 64 = 224 days

For dates spanning multiple years, add the days remaining in the first year, all days in complete years between, and days elapsed in the final year.

The Leap Year Rule

A year is a leap year if:

β€’ Divisible by 4 (e.g., 2024 βœ“) β€’ EXCEPT if divisible by 100 (e.g., 1900 βœ—) β€’ UNLESS also divisible by 400 (e.g., 2000 βœ“)

Leap years between 2000 and 2030: 2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028.

When counting days across year boundaries, count 366 days for leap years and 365 for all others.

Days Between Dates in Excel

Excel stores dates as serial numbers (number of days since January 0, 1900), making date subtraction simple:

Simple subtraction: =B1-A1 (gives days between A1 and B1) Using DAYS function: =DAYS(end_date, start_date) Using DATEDIF: =DATEDIF(A1, B1, "D") β†’ total days =DATEDIF(A1, B1, "M") β†’ complete months =DATEDIF(A1, B1, "Y") β†’ complete years Business days (excluding weekends): =NETWORKDAYS(start_date, end_date)

Format the result cell as "Number" not "Date" to see the numeric day count.

Days Between Dates in Python, JavaScript, and SQL

Python:

from datetime import date d1 = date(2025, 1, 1) d2 = date(2026, 3, 5) delta = d2 - d1 print(delta.days) # 428

JavaScript:

const d1 = new Date('2025-01-01'); const d2 = new Date('2026-03-05'); const diff = Math.round((d2 - d1) / (1000 * 60 * 60 * 24)); // Result: 428 days

SQL:

-- MySQL SELECT DATEDIFF('2026-03-05', '2025-01-01'); -- 428 -- PostgreSQL SELECT '2026-03-05'::date - '2025-01-01'::date; -- 428

Calculating Business Days (Excluding Weekends and Holidays)

Business days exclude weekends (Saturday and Sunday). Counting them manually requires knowing the weekday of the start date.

Quick formula for business days:

Total weeks = floor(calendar days / 7) Business days = Total weeks Γ— 5 + weekdays in remaining days

For example, 30 calendar days starting on a Monday:

  • 30 Γ· 7 = 4 complete weeks (20 business days)
  • 2 remaining calendar days (Mon–Tue) = 2 business days
  • Total = 22 business days

Holidays vary by country and region, so automated calculation is more reliable than manual counting for business purposes.

β†’ Calculate working days with our Business Days Calculator (excludes weekends automatically).

Converting Days to Weeks and Months

Converting days to other units:

ConversionFormulaExample (100 days)
Days to weeksdays Γ· 714.3 weeks
Days to months (approx)days Γ· 30.443.28 months
Days to years (approx)days Γ· 365.250.274 years

Note: "months" is always approximate since months have different lengths. For exact month calculations, use DATEDIF or similar date-aware functions.

Frequently Asked Questions

A regular year has 365 days. A leap year has 366 days. The average year length is 365.25 days, which is why we add a leap day every 4 years. For accurate multi-year calculations, account for leap years individually.
Add 1 to the standard calculation. For example, from March 1 to March 10 is normally 9 days. Including both start and end dates (March 1 through March 10), there are 10 days. This inclusive count is often used for hotel nights, rental periods, and event durations.
A standard year has approximately 261 working days (365 days minus 52 weekends Γ— 2 days). After typical US public holidays (10-11 days), it is approximately 250 working days. This varies by country β€” the UK has ~252, India ~250-255 depending on state.
Simply subtract one date cell from another: =B1-A1 where B1 is the later date. Format the result as a number. Alternatively, use =DAYS(B1, A1) or =DATEDIF(A1, B1, 'D') for the same result.