Time & Dates

Date difference calculator: days between two dates

Two dates have more than one correct gap. This explains inclusive against exclusive counting, the weekday algorithm, and why months between dates is ambiguous.

By the Life Calculator team Updated Free, no sign-up Nothing you type leaves your device

Your numbers

Result

Result
--

Runs entirely in your browser. Nothing you type is sent anywhere, stored or shared.

In short

  • The total day count is a subtraction of serial day numbers; every other output on the page is derived from that one figure.
  • Inclusive counting adds exactly one day and is the correct choice when each calendar day is itself a unit of service or leave.
  • Months between two dates has at least three defensible answers, so the convention has to be stated before the number means anything.
  • Every whole week contains five weekdays regardless of its start day, which makes the weekday count a division plus a short walk.
  • Public holidays cannot be applied automatically because they depend on jurisdiction, employer and contract rather than the calendar.
On this page
  1. The formula
  2. A worked example, done by hand
  3. Inclusive against exclusive counting
  4. Why "months between two dates" has no single answer
  5. Counting weekdays, and why holidays are not automatic
  6. Day-count conventions in finance
  7. Where each input comes from
  8. How to read the result
  9. What this model leaves out
  10. Common mistakes

The gap between two dates has more than one correct answer, and the disagreements are not rounding noise. A stay from March 2 to March 5 is three nights or four days depending on what you are counting, and a contract that says "within 30 days" can mean two different deadlines depending on whether the first day counts.

This calculator takes a start date, an end date and a switch that decides whether both the first and last day are included. It returns the total days, the years-months-days breakdown, weeks, whole weeks plus leftover days, approximate months and years, weekdays only, weekend days, total hours, and the day of the week at each end.

What follows is the arithmetic behind each of those outputs, where the conventions collide, and how to pick the one your situation actually requires.

The formula

The core figure is a difference of day numbers. Convert each date to a serial day count -- the number of days since a fixed reference date -- and subtract.

Formula: total days = serial(end) - serial(start), plus 1 if both endpoints are counted. The breakdown uses component subtraction with borrowing: years = Y2 - Y1, months = M2 - M1, days = D2 - D1; if days < 0, add the length of the month before the end date and reduce months by 1; if months < 0, add 12 and reduce years by 1.

Symbols: Y1-M1-D1 is the start date, Y2-M2-D2 the end date. The serial conversion is what handles leap days without any special case -- February 29 simply occupies a serial number like every other day.

The derived rows are all functions of the day total: weeks = days / 7, whole weeks and a remainder from days // 7 and days % 7, hours = days x 24, approximate months from days / 30.4375 and approximate years from days / 365.25. The divisor 30.4375 is 365.25 / 12, the mean month length under the leap-year cycle.

A worked example, done by hand

Worked example: March 2, 2026 (a Monday) to May 15, 2026 (a Friday).

  1. Days remaining in March after the 2nd: 31 - 2 = 29. April contributes 30. May contributes 15. Total: 29 + 30 + 15 = 74 days, exclusive of the start date.
  2. With both endpoints counted, add one: 75 days.
  3. Breakdown: 5 - 3 = 2 months and 15 - 2 = 13 days, with no borrowing needed, so 2 months and 13 days.
  4. Weeks: 74 / 7 = 10.57, or 10 whole weeks and 74 - 70 = 4 days.
  5. Weekdays: 10 whole weeks contribute 10 x 5 = 50 weekdays and 20 weekend days. The 4 leftover days run Monday May 11 through Thursday May 14, all weekdays, so 50 + 4 = 54 weekdays and 20 weekend days.
  6. Hours: 74 x 24 = 1,776.

Every one of those steps is reproducible on paper. The only piece that needs a calendar is step 5, because the leftover days must be walked through individually.

Inclusive against exclusive counting

Exclusive counting -- the default -- measures the interval between the two dates, which is the number of nights. Inclusive counting measures the number of calendar days touched, which is what you want when each day is a unit of service or occupancy.

Situation What is being counted Convention
Hotel nights, Mar 2 to Mar 5 3 nights exclusive
Days of a conference, Mar 2 to Mar 5 4 days inclusive
Days of PTO taken, Mar 2 to Mar 5 4 days inclusive
Interest accrued, Mar 2 to Mar 5 3 days exclusive
Age, birth to today completed days exclusive
Rental car days, Mar 2 to Mar 5 3 or 4, by contract stated in the terms

The off-by-one is not a rounding question, it is a definition question, and it is expensive in exactly the places where nobody checks. A notice period of "30 days from March 2" ends April 1 under exclusive counting and March 31 under inclusive counting. A billing period stated inclusively on one side and exclusively on the other double-counts a day every cycle.

Note: when a document says "from" a date, exclusive counting is the more common legal reading, and "beginning on" usually signals inclusive counting. The document controls, not the arithmetic.

Why "months between two dates" has no single answer

A month is not a fixed quantity. Three reasonable methods give three different answers for the same pair of dates, and none of them is wrong.

Start and end Days Borrowing breakdown Days / 30.4375
Jan 31 to Feb 28, 2026 28 0 months, 28 days 0.92
Aug 31 to Sep 30, 2026 30 0 months, 30 days 0.99
Jan 31 to Mar 31, 2026 59 2 months, 0 days 1.94
Mar 2 to May 15, 2026 74 2 months, 13 days 2.43
Jan 1 to Dec 25, 2026 358 11 months, 24 days 11.76

The first two rows are the interesting ones. Most people would call January 31 to February 28 "one month" because it runs end of month to end of month, but the component arithmetic says zero months and 28 days, because February never reaches a 31st. The same happens from August 31 to September 30.

So there are at least three conventions in play: end-of-month matching, same-day-of-month anniversary, and an average-length divisor. Subscription billing usually uses end-of-month matching, loan schedules usually use the anniversary rule, and statistical work usually uses the divisor. Check which one applies before quoting a figure in months.

Counting weekdays, and why holidays are not automatic

The weekday count uses the structure of the week rather than a day-by-day loop for the bulk of the work.

  1. Divide the total days by 7. Each whole week contributes exactly 5 weekdays and 2 weekend days, regardless of where it starts.
  2. Walk the remaining days % 7 days individually, starting from the day of the week of the start date, and count how many fall Monday through Friday.
  3. Weekend days are the total minus the weekdays.

That is why the answer here counts Saturdays and Sundays only. Public holidays cannot be included automatically because they are not a property of the calendar -- they are a property of a jurisdiction, an employer and sometimes a contract. Federal holidays differ from state holidays, several move with the day of the week, some are observed on an adjacent weekday when they fall at the weekend, and private employers are not obliged to follow any of them. Subtract your own holiday list from the weekday figure.

Day-count conventions in finance

Finance solved the same ambiguity by writing the convention into the contract. The two parts are the numerator, meaning how days are counted, and the denominator, meaning how many days a year is deemed to have.

Assume a balance of $10,000 and an assumed nominal rate of 6% a year. The interest for the same calendar span differs by convention:

Span Actual days 30/360 days actual/365 actual/360 30/360
Jan 31 to Apr 30 89 90 $146.30 $148.33 $150.00
Feb 1 to Mar 1 28 30 $46.03 $46.67 $50.00
Jan 1 to Jul 1 181 180 $297.53 $301.67 $300.00

The 30/360 convention pretends every month has 30 days and every year 360, which makes coupon payments equal and schedules tidy. Actual/360 counts real days but divides by 360, which quietly raises the effective rate by a factor of 365/360, about 1.4%. Actual/365 counts real days over a real year.

None of this is a trick; it is disclosed in the terms. It is worth knowing because it is the same ambiguity this page is about, priced in dollars. The loan calculator and the credit card payoff calculator both assume regular monthly periods, which is the simplification most consumer schedules use.

Where each input comes from

Both dates should come from the document that governs the question -- the contract date, the invoice date, the start date on an offer letter -- not from memory. If a document gives a date without a year, resolve the year before entering anything.

The inclusive switch is the input that changes the answer most, and it is the one people skip. Set it by asking whether the first day is itself a unit of the thing you are counting. If the answer is nights, interest days or elapsed time, leave it off. If the answer is days of service, days of attendance or days of leave, turn it on.

Order does not matter: reversing the dates gives the same magnitude, with the calculator noting that the dates were swapped.

How to read the result

The total days figure is the exact one. Everything below it is either a repackaging of that figure or an approximation, and the approximations are labeled.

Take the weeks row as a decimal for planning capacity and the whole-weeks-plus-days row for scheduling, since work rarely happens in fractions of a week. The approximate months and years rows use average month and year lengths and will not agree with the borrowing breakdown; the breakdown is the one to quote when precision matters.

The weekday count is the figure that maps onto a working schedule. Multiply it by the daily hours from the time card calculator to convert a date range into a labor budget, or feed it into the PTO accrual calculator when the range covers a leave period.

What this model leaves out

  • Time of day. The calculation compares dates, not timestamps. A span from 11 pm on one day to 1 am the next counts as one day, not two hours.
  • Time zones. Two events an hour apart can fall on different calendar dates in different zones. Fix a single zone before counting.
  • Daylight saving. A civil day is not always 24 hours. In regions that observe it, one day a year has 23 hours and one has 25, so the hours row can be off by an hour either way across a spring or fall transition.
  • Holidays and closures. Weekday counts exclude weekends only.
  • Business-day rolling. Financial contracts often shift a date that lands on a weekend to the next or previous business day. That adjustment is not applied here.
  • Historical calendars. Dates before the local Gregorian adoption do not line up with modern serial day numbering.

Common mistakes

Counting inclusively on one side only. If the start date counts as day one, the end date must be included too. Mixing the conventions inside one calculation is the source of most billing disputes over a single day.

Treating "30 days" as "a month". They are equal in exactly four months of the year. For a deadline stated in days, count days.

Assuming 52 weeks is a year. 52 x 7 = 364, so a 52-week schedule is a day short of a common year and two days short of a leap year. Over five years that drifts by nearly a week.

Reading weekday counts as business days. They are not the same wherever holidays exist.

Forgetting February 29. Any span that crosses a leap day is a day longer than the same span in a common year, which matters for daily-rate billing. The age calculator shows the same effect over decades.

Rounding months to compare durations. Two spans both reported as "2.4 months" can be several days apart. Compare the day totals.

Frequently asked questions

Should the first day be counted in a date difference?
It depends on what a day represents in your situation. If you are counting nights, elapsed time or interest days, leave the first day out: March 2 to March 5 is three nights. If each calendar day is itself a unit being consumed -- a day of leave, a day of attendance, a day of service -- count both ends and the same span becomes four days. Contracts usually state which reading applies, and the wording controls the arithmetic.
How many days are between two dates that cross a leap day?
One more than the same span in a common year. February 29 occupies an ordinary position in the day count, so no adjustment is needed as long as the calculation converts each date to a serial day number and subtracts. This matters most for anything billed at a daily rate, where a span crossing February 29 costs one extra day, and for annual comparisons, where a leap year is 366 days rather than 365.
Why do different tools disagree about the number of months between two dates?
Because a month has no fixed length, so the answer depends on the convention. Component subtraction with borrowing says January 31 to February 28 is zero months and 28 days. End-of-month matching, common in subscription billing, calls the same span one month. Dividing days by 30.4375, the mean month length, gives 0.92. All three are defensible. Check which convention your contract, invoice or payroll system uses before quoting a figure in months.
How are weekdays counted between two dates?
Divide the total days by seven. Every whole week contains exactly five weekdays and two weekend days no matter which day it starts on, so multiply the whole weeks by five. Then walk the remaining days one at a time, starting from the day of the week of the start date, and count those falling Monday through Friday. Add the two parts. The weekend total is the overall day count minus the weekday count.
Why can't the weekday count exclude public holidays?
Because holidays are not a property of the calendar. They vary by country, state and employer, several shift with the day of the week, some are observed on an adjacent weekday when they land at the weekend, and private employers set their own schedules. Any automatic list would be wrong for a large share of users. The practical approach is to take the weekday figure and subtract the holidays that actually apply to your workplace or contract.
What does a day-count convention like 30/360 mean?
It is a rule written into a financial contract that fixes how days are counted and how long a year is deemed to be. 30/360 treats every month as 30 days and every year as 360, which makes payment schedules uniform. Actual/365 counts real days over a real year. Actual/360 counts real days but divides by 360, which raises the effective rate by roughly 1.4%. The convention is disclosed in the loan terms.
Is a day always 24 hours long?
Not as a civil day. Where daylight saving time is observed, one day each spring is 23 hours and one day each fall is 25, so an hour total derived by multiplying days by 24 can be off by an hour across a transition. Time zone changes have the same effect on a traveler's local clock. For contractual hour counts across a transition, use recorded start and end times rather than a day-based conversion.
Does it matter which date I enter first?
No. If the end date falls before the start date, the calculation swaps them and reports the same magnitude, noting that the order was reversed. What does change the answer is the inclusive switch, which adds exactly one day to every output derived from the day total, including weeks, hours and, when the extra day falls on a weekday, the weekday count.

Sources and further reading

Where this page relies on a published formula, an official figure or a legal rule, the primary source is listed here. External links open in a new tab and we earn nothing from them.

  1. U.S. Department of Labor -- wage, hour and leave standards
  2. Consumer Financial Protection Bureau -- Ask CFPB on loan terms and billing
  3. NIST -- official U.S. time and civil timekeeping
  4. USA.gov -- federal holidays and government service dates
  5. Bureau of Labor Statistics -- work schedules and time use data

Related calculators

All time & dates tools →