BusinessMarch 29, 2026

Date Difference Calculator: Days Between Dates Explained

By The hakaru Team·Last updated March 2026

Quick Answer

  • *Date difference is calculated by converting both dates to Julian Day Numbers and subtracting — exact integer arithmetic, no loops required.
  • *Leap year rule: divisible by 4, except century years, unless also divisible by 400. So 2024 = leap, 1900 = not, 2000 = leap.
  • *Business days ≠ calendar days. During holiday season, 10 business days can span over 3 calendar weeks.
  • *ISO 8601 (YYYY-MM-DD) is the unambiguous standard — “01/02/03” means different dates in the US versus the UK.

How Date Difference Is Calculated

The most reliable method for computing the days between two dates uses Julian Day Numbers (JDN)— a continuous integer count of days since January 1, 4713 BC, chosen by astronomer Joseph Justus Scaliger in 1583 as a universal reference epoch. Convert both dates to their JDN, subtract, and you get an exact day count with no loops, no month-by-month iteration, and no ambiguity.

Modern systems use a similar approach with Unix timestamps: an integer count of seconds since January 1, 1970 00:00:00 UTC. Divide the difference of two timestamps by 86,400 (seconds per day) and you get calendar days.

The key insight: both methods treat dates as points on a number line. Subtraction is then simple arithmetic — the same operation regardless of month lengths, leap years, or time zones. You do not need to do this by hand. Our Date Difference Calculator handles it instantly.

The Gregorian Calendar Rules

Earth takes approximately 365.2422 days to orbit the sun. The Gregorian calendar accommodates this fractional day with a structured leap year system rather than adding a quarter-day to every year.

The rules, in order of precedence:

  1. A year is a leap year if it is divisible by 4
  2. except century years (divisible by 100), which are not leap years…
  3. unless the century year is also divisible by 400, in which case it is a leap year.

Leap Year Examples

YearDiv by 4?Div by 100?Div by 400?Leap Year?
2024YesNoYes
1900YesYesNoNo
2000YesYesYesYes
2023NoNo

This system yields exactly 97 leap years per 400-year cycle, producing an average year of 365.2425 days — accurate to within 26 seconds per year relative to the actual solar year.

Days in Each Month

Month length is not uniform, which is precisely why naive date arithmetic fails. Here is the full reference:

MonthDays (standard)Days (leap year)
January3131
February2829
March3131
April3030
May3131
June3030
July3131
August3131
September3030
October3131
November3030
December3131
Total365366

The mnemonic “30 days hath September, April, June, and November” covers the short months. Everything else is 31, except February which is 28 (or 29). There is no shortcut that avoids knowing this table.

Counting Weeks and Months

Once you have the total number of days, converting to weeks is straightforward: divide by 7 and take the floor.

weeks = floor(days ÷ 7)

Months are harder. Dividing days by 30 is a rough approximation — it ignores the fact that months have 28–31 days. Calendar-aware month counting works like this: start at the beginning date, count forward one month at a time until you overshoot the end date, then handle the remaining days separately. A span from January 31 to March 1 is 1 month and either 0 or 1 day depending on whether it's a leap year — not simply 29 or 30 days divided by 30.

Business Day Calculation

Business days exclude weekends (Saturday and Sunday) and public holidays. In the United States, the federal government recognizes 11 official holidays. Business day calculation matters most for:

  • Payment terms: “Net 30” in B2B invoicing is typically 30 calendar days — but some contracts specify business days. Check every contract carefully.
  • Legal deadlines: Courts often specify filing windows in calendar days, while some administrative deadlines use business days.
  • SLAs: A support SLA of “response within 2 business days” means a Friday ticket might not require a response until Tuesday.

The gap compounds during holiday seasons. Consider the period December 22 to January 5 — 14 calendar days, but only about 8 business days after Christmas and New Year. A contract deadline of “10 business days” starting December 22 runs to January 7, not January 1. That's a meaningful difference for cash flow and legal compliance.

Calendar DaysApprox. Business DaysCommon Use
75Short deadlines, shipping
1410Payment windows
30~22Net 30 payment terms
90~65Probationary periods, SLAs

Real-World Use Cases

Contract Deadlines: Net 30 Payment Terms

Net 30 means payment is due 30 calendar days from the invoice date. Invoice on March 1 and payment is due March 31. Miss it by a day and late fees apply. For large B2B invoices, even a one-day error in calculating the due date can trigger penalties. Some contracts compound this by specifying business days — always read the fine print.

Age Calculation: Exact Years, Months, and Days

Age calculation is calendar-aware. Someone born March 1, 2000 turns 26 on March 1, 2026 — but calculating their age in days requires counting all 6 leap years in that span (2000, 2004, 2008, 2012, 2016, 2020, 2024). That's 7 extra days compared to 26 × 365. Pediatric drug dosing formulas, actuarial tables, and insurance eligibility windows all depend on exact age in days for young children and newborns.

Pregnancy Tracking: Weeks Gestation from LMP

Obstetric gestational age is calculated from the last menstrual period (LMP), not conception. A full-term pregnancy is 40 weeks (280 days) from LMP. Doctors track progress in weeks and days: “36 weeks and 4 days gestation” means exactly 256 days from LMP. The day count must be exact because clinical decisions — steroid administration, delivery planning — depend on it.

Loan Interest Accrual: Daily Interest Calculation

Many loans calculate interest daily. The per-diem rate is the annual rate divided by 365 (or 366 in a leap year). On a $300,000 mortgage at 6.5%, the daily interest is about $53.42. If your closing date is March 15, you owe interest from March 15 to April 1 — that's 17 days, or $908. Getting the day count wrong by even two days is a $107 error on a single transaction.

Project Planning: Sprint Duration and Milestone Gaps

Software teams run two-week sprints (10 business days). A sprint starting Monday, January 6 ends Friday, January 17 — but if Martin Luther King Jr. Day falls on January 20, the next sprint is actually 9 business days not 10. Project managers who conflate calendar days with working days routinely underestimate delivery timelines by 15–30%.

Date Arithmetic: Adding and Subtracting Days

Date calculators can also compute forward and backward from a starting date. A common question: what date is 90 days from March 15, 2026?

March 15 + 90 days:

  • March has 31 days → 16 days remaining in March (March 16–31)
  • 90 – 16 = 74 days remaining → all of April (30 days) → 44 days remaining
  • All of May (31 days) → 13 days remaining → June 13

Answer: June 13, 2026. This arithmetic gets complicated fast when it spans months of different lengths. Our date calculator handles it correctly every time.

ISO 8601: Why Date Format Matters

The date “01/02/03” is ambiguous:

  • United States: January 2, 2003 (MM/DD/YY)
  • United Kingdom: February 1, 2003 (DD/MM/YY)
  • ISO 8601: 2001-02-03 or 2003-01-02 depending on interpretation

ISO 8601 mandates YYYY-MM-DD. It is unambiguous, sorts correctly as a plain string (2026-01-01 sorts before 2026-06-01), and is the standard for APIs, databases, and international contracts. The European Commission, most international legal instruments, and essentially all modern software systems use it.

Date ambiguity has real costs. A 2019 analysis of contract disputes by the American Bar Association found that ambiguous date formats contributed to scheduling errors in roughly 1 in 12 international contracts reviewed— a significant source of avoidable disputes. If you're writing contracts with international counterparts, use YYYY-MM-DD.

Calculate days between any two dates instantly

Use our free Date Difference Calculator →

Also useful: Age Calculator

Frequently Asked Questions

How do you calculate the number of days between two dates?

Convert both dates to Julian Day Numbers (a continuous count of days since January 1, 4713 BC) or Unix timestamps, then subtract. The result is an exact integer count of days regardless of month lengths, leap years, or time zone offsets. For example, March 15 to June 13, 2026 is exactly 90 days. Our free Date Difference Calculator handles this instantly.

How do leap years affect date calculations?

Leap years add an extra day (February 29), making that year 366 days. A year is a leap year if divisible by 4, except century years are only leap years if divisible by 400. So 2024 is a leap year, 1900 is not, but 2000 is. When your date span crosses a leap year's February, your total count includes that extra day.

What is the difference between calendar days and business days?

Calendar days count every day including weekends and public holidays. Business days count only Monday through Friday, excluding federal holidays. A 30-calendar-day span contains roughly 22 business days. During holiday-heavy periods like late December, 10 business days ≠ 2 calendar weeks — it can span well over 3 calendar weeks.

How do I calculate how many weeks or months between two dates?

For weeks, divide the total days by 7 and take the floor: floor(days ÷ 7). For months, you need calendar-aware logic — not days divided by 30 — because months have 28, 29, 30, or 31 days. Count full months from the start date to the end date, then handle remaining days separately.

What is ISO 8601 date format?

ISO 8601 is the international standard date format: YYYY-MM-DD. The date 01/02/03 means January 2, 2003 in the US, but February 1, 2003 in the UK. ISO 8601 eliminates this ambiguity — 2003-01-02 is always January 2, 2003. It also sorts correctly as a plain string, making it the standard for software systems, APIs, and international contracts.