Enter a start date and an end date. You get the days between them, the inclusive count (with the end date also counted as a day), and the same period in weeks, months, and years, months and days.
Table of Contents
-
What you can do on this page
-
What is this calculation used for?
-
How to Use
-
Formula
-
Symbols and terms
-
Good to know before you start
-
How to calculate it in Excel
-
How to calculate it in Google Sheets
-
How to calculate it in Python
-
How to write it in LaTeX and other math languages (copy and paste)
-
How to have ChatGPT do the calculation
-
DataChef Features
-
Related Features
-
NumberChef Calculators List
What you can do on this page
- Enter a start date and an end date to get the number of days between them on the spot. Leave one of them blank to count "days until the exam" or "days since our anniversary" from today
- You see both "days between" (the start date not counted) and the inclusive count (both the start and end dates counted), so you will not mix them up when counting hotel nights, days of medicine or prorated rent
- The same period is also shown in years, months and days, in months, and in weeks
- A plain-language explanation of how to count days and copy-and-paste formulas for Excel, Google Sheets and Python are all on this page
What is this calculation used for?
"If today is July 3 and the exam is on January 16 next year, 197 days are left." Once you know the days left, you can plan with numbers instead of a feeling. For example, to work through 10 practice tests in about 200 days, you have 20 days for each one.
A countdown naturally uses the subtraction, which does not count today. The day before, it shows "1 day left", and on the day itself, "0 days left".
A trip where you check in on August 13 and check out on August 16 is \(16 - 13 = 3\) nights by subtraction, and 4 days by the inclusive count - "3 nights, 4 days".
Hotels charge by the night (subtraction), while things like travel insurance and some rentals charge by the day (inclusive count). Knowing the difference keeps your budget right. (Car rentals often charge per 24 hours rather than per calendar day.)
A 7-day supply of medicine that starts on July 1 is counted inclusively, so the last day you take it is July 7. If you think of it as a subtraction (\(7 - 1 = 6\)), you are off by one day.
Checking "will my medicine last until my next appointment or refill?" means comparing two counts that work differently: the days supplied (inclusive count) and the days until the appointment (subtraction). Knowing the difference helps you avoid running out.
If you move in on July 10, the first month's rent is often prorated for 22 days out of 31 (inclusive count, \(31 - 10 + 1 = 22\)). You use the apartment on the move-in day itself, so the first day is counted.
Pay for starting or leaving a job in the middle of a month works the same way. How days are counted (inclusive or not) can depend on the lease or contract, so use this to check the numbers against what your contract says.
Interest is calculated in proportion to the number of days, as in "principal × rate × days ÷ 365". Banks commonly count interest from the day of the deposit up to, but not including, the day of the withdrawal - that is, counting one end only, the same as the subtraction.
For example, if you deposit money on April 1 and withdraw it on April 30, that is 29 days of interest. A one-day difference in counting changes the interest, so this helps you read the day-count terms in your account or loan documents.
Pregnancy is counted from the first day of the last menstrual period as day 0, and day 280 (\(280 = 7 \times 40\), so 40 weeks 0 days) is the usual estimated due date. "How many weeks and days pregnant am I today?" is exactly the weeks formula on this page: divide the days since the start date by 7.
Prenatal visits and tests are scheduled by week, so being able to switch between days and weeks makes your records much easier to follow.
Formula
Symbols and terms
Symbols
| \(D\) | D | The number of days between two dates (the answer of the date subtraction, with the start date as day 0). From the first letter of "days". |
| \(N_1\), \(N_2\) | N sub 1, N sub 2 | The serial numbers of the start date (\(N_1\)) and the end date (\(N_2\)). The same idea as the serial numbers in Excel, which count days with January 1, 1900 as number 1. |
| \(D'\) | D prime | The inclusive count, with both the start date and the end date counted as a day. \(D' = D + 1\). The prime mark (′) is often used for a slightly changed version of the original quantity. |
| \(W\), \(r\) | W, r | The weeks (\(W\)) and the extra days (\(r\)). Divide the days \(D\) by 7. The whole-number answer is \(W\) and the remainder is \(r\). |
| \(y\), \(m\), \(d\) | y, m, d (lowercase) | The parts of a period split into "\(y\) years \(m\) months \(d\) days". (Example - for 1 year, 2 months and 10 days, \(y = 1\), \(m = 2\), \(d = 10\)) |
| \(M\) | M (capital) | The period written in months only (total months). Found with \(M = 12y + m\). (Example - 1 year 2 months is \(M = 14\) months) |
Terms
| calendar days | Every day on the calendar, counted the same whether it is a weekday, a weekend or a holiday. This is different from business days (days without weekends and holidays). This page counts calendar days. |
| exclusive count | A way of counting a period that does not count the first day. Subtracting one date from the other gives this count, with the start date as day 0. "Within 3 days from today" in this sense starts counting from tomorrow. Many legal and contract deadlines are counted this way, but check the exact wording when it matters. |
| inclusive count | A way of counting in which both the start date and the end date count as a day. It is the answer of the date subtraction plus 1. It is used when each day itself is used, such as days of medicine, rental periods or the length of a construction job. |
| counting one end | A way of counting in which only one of the start date and the end date is counted. The answer is the same as the date subtraction. Banks often count interest days this way - interest is earned from the day of the deposit up to, but not including, the day of the withdrawal. If neither end is counted, the answer is the subtraction minus 1. |
| corresponding date | The same day number in a later month or year. For January 15, the corresponding date in the next month is February 15. The extra months in a period are counted by whether this date has been reached. When the next month has no such day, as with January 31, the last day of that month takes its place, and the month is complete when that last day ends. |
| leap year | A year with a February 29. It usually comes every 4 years, but years divisible by 100 are common years unless they are divisible by 400 (2100 is not a leap year, 2000 was). This calculator counts like a calendar, so a February 29 inside the period is counted as a day. |
| serial number | The running number that Excel and spreadsheets use to store dates. January 1, 1900 is 1, and the number goes up by 1 each day (January 1, 2025 is 45658). You can subtract one date from another in Excel because a date is really this number. Excel has an old quirk of counting a "February 29, 1900" that never existed, so these numbers are 1 larger than a true calendar count (this does not affect the number of days you get by subtraction). |
Good to know before you start
Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.
If you get stuck, going back over these topics is the quickest way forward.
| How the calendar works (Grades 3–4) |
|
| Subtraction on paper (Grades 2–4) |
|
| Division with remainders (Grade 4) |
|
| Multi-digit multiplication (Grades 4–5) |
|
How to calculate it in Excel
| Start date | 2025-01-01 |
| End date | 2025-03-01 |
| Days between (start date not counted) | =B2-B1 |
| Inclusive count (both dates counted) | =B2-B1+1 |
| Start date | 2025-01-01 |
| End date | 2025-03-01 |
| Weeks | =INT((B2-B1)/7) |
| Extra days | =MOD(B2-B1,7) |
| Start date | 2025-01-01 |
| End date | 2025-03-01 |
| Years | =DATEDIF(B1,B2,"Y") |
| Extra months | =DATEDIF(B1,B2,"YM") |
| Extra days | =DATEDIF(B1,B2,"MD") |
| Total months | =DATEDIF(B1,B2,"M") |
| A past date (such as an anniversary) | 2025-01-01 |
| Days from that date to today | =TODAY()-B1 |
| A future date (such as an exam) | 2027-01-16 |
| Days from today to that date (days left) | =B3-TODAY() |
In the DATEDIF function in the third table, the third argument means: "Y" = years, "YM" = extra months, "MD" = extra days, "M" = total months. (DATEDIF does not appear in the list of suggested functions, but it has worked in every version of Excel.) However, "MD" is known to be off by 1 or 2 days, or even to give odd values, around the ends of months (for example, when you start on the 31st). When the extra days matter, use this calculator's result as your guide.
With TODAY() as in the fourth table, the "since today" and "until today" counts update every time you open the file.
How to calculate it in Google Sheets
| Start date | 2025-01-01 |
| End date | 2025-03-01 |
| Days between (start date not counted) | =B2-B1 |
| Inclusive count (both dates counted) | =B2-B1+1 |
| Start date | 2025-01-01 |
| End date | 2025-03-01 |
| Weeks | =INT((B2-B1)/7) |
| Extra days | =MOD(B2-B1,7) |
| Start date | 2025-01-01 |
| End date | 2025-03-01 |
| Years | =DATEDIF(B1,B2,"Y") |
| Extra months | =DATEDIF(B1,B2,"YM") |
| Extra days | =DATEDIF(B1,B2,"MD") |
| Total months | =DATEDIF(B1,B2,"M") |
| A past date (such as an anniversary) | 2025-01-01 |
| Days from that date to today | =TODAY()-B1 |
| A future date (such as an exam) | 2027-01-16 |
| Days from today to that date (days left) | =B3-TODAY() |
As in Excel, if a subtraction shows up as a date, change the format to "Number" (Format > Number), and DATEDIF with "MD" can be off by 1 or 2 days around the ends of months.
How to calculate it in Python
from datetime import date
start = date(2025, 1, 1) # start date
end = date(2025, 3, 1) # end date (use date.today() for today)
days = (end - start).days # days between the two dates (start date not counted)
days_inclusive = days + 1 # counting both the start and end dates (inclusive)
weeks, extra_days = divmod(days, 7) # weeks and extra days
# Total months: year difference x 12 + month difference. If the end day comes before the start day, the last month is not complete yet, so subtract 1
total_months = (end.year - start.year) * 12 + (end.month - start.month) - (end.day < start.day)
print(f"Days: {days} days ({days_inclusive} days inclusive)")
print(f"Weeks: {weeks} weeks and {extra_days} days")
print(f"Total months: {total_months} months")
How to write it in LaTeX and other math languages (copy and paste)
D = N₂ − N₁
D = N_2 - N_1
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>D</mi><mo>=</mo>
<msub><mi>N</mi><mn>2</mn></msub><mo>−</mo>
<msub><mi>N</mi><mn>1</mn></msub>
</mrow>
</math>
D = N_2 - N_1
days = DateDifference[startDate, endDate, "Day"]
days := n2 - n1;
days_between = days(end_date - start_date);
D = N_2 - N_1
D′ = D + 1
D' = D + 1
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<msup><mi>D</mi><mo>′</mo></msup><mo>=</mo>
<mi>D</mi><mo>+</mo><mn>1</mn>
</mrow>
</math>
D' = D + 1
daysInclusive = days + 1
daysInclusive := days + 1;
days_inclusive = days_between + 1;
D' = D + 1
D = 7W + r (0 ≤ r ≤ 6)
D = 7W + r\ \ (0 \le r \le 6)
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>D</mi><mo>=</mo>
<mn>7</mn><mi>W</mi><mo>+</mo><mi>r</mi><mspace width="0.7em"/>
<mo>(</mo><mn>0</mn><mo>≤</mo><mi>r</mi><mo>≤</mo><mn>6</mn><mo>)</mo>
</mrow>
</math>
D = 7W + r (0 <= r <= 6)
{weeks, remDays} = QuotientRemainder[days, 7]
weeks := iquo(days, 7); remDays := irem(days, 7);
num_weeks = floor(days_between/7); rem_days = mod(days_between, 7);
D = 7W + r (0 ≤ r ≤ 6)
M = 12y + m
M = 12y + m
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>M</mi><mo>=</mo>
<mn>12</mn><mi>y</mi>
<mo>+</mo><mi>m</mi>
</mrow>
</math>
M = 12y + m
totalMonths = 12*years + extraMonths
totalMonths := 12*years + extraMonths;
total_months = 12*num_years + extra_months;
M = 12y + m
How to have ChatGPT do the calculation
You are a day-counting assistant. Do the following calculation by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing). The start date is January 1, 2025, and the end date is March 1, 2025. Find each of the following: 1. The number of days between the two dates (the date subtraction, with the start date as day 0) 2. The number of days counting both the start date and the end date as a day (inclusive count) 3. The number from 1 written as "X weeks and Y days" Show the code you used and the numbers from the execution result.
How to Use
-
1Enter your numbersType the numbers you want to calculate with into the input fields
-
2CalculatePress the "Calculate" button
-
3Check the resultThe result appears on the spot. The same page also explains the idea behind the calculation and the formula
DataChef Features
No technical knowledge required.
Intuitive and user-friendly operation.
Can be used without registering personal information.
Automatic file deletion by clicking "download".
and rapid file conversion.
No attribution required.
No need to contact us for commercial use permission.
