Home › How to Calculate Days Between Two Dates
How to Calculate the Number of Days Between Two Dates
By The Editors, Encore Editorial, Updated June 21, 2026
To find the number of days between two dates, subtract the earlier date from the later one. Each calendar day counts as one unit. The tricky part is that months vary in length and leap years add a day in February, so manual counting invites errors. A date calculator handles all of that for you instantly.
Why this comes up more often than you think
Contracts expire. Subscriptions renew. Passports have validity windows. Project deadlines loom. All of these problems reduce to one question: how many days separate two points on the calendar? The math sounds simple until you realize February does not cooperate and neither do the various definitions of "a day."
This guide walks through the mechanics, shows you worked examples, and covers the edge cases worth knowing before you trust a number on anything important.
The basic method
At its core, counting days between two dates is subtraction. Convert both dates to a number, subtract, and you have the answer. Every major computer system internally represents dates as a count of days from some fixed starting point (Excel uses January 1, 1900; Unix systems use January 1, 1970). Subtracting those two numbers gives the elapsed days directly.
By hand, you have a few options:
- Count on a calendar. Works fine for short spans. Tedious for anything over a few weeks.
- Use a spreadsheet formula. In Excel or Google Sheets,
=B1-A1 (where A1 is the earlier date) returns the number of days. Format the result cell as a number, not a date.
- Use an online date calculator. Fastest and least error-prone. The date calculator on this site returns the answer the moment you enter both dates.
Worked examples with real dates
Concrete numbers are worth more than abstract rules. Here are five examples covering different scenarios.
| Start date | End date | Days between | Notes |
| January 1, 2026 | March 1, 2026 | 59 days | 2026 is not a leap year; February has 28 days |
| January 1, 2024 | March 1, 2024 | 60 days | 2024 is a leap year; February has 29 days |
| June 21, 2026 | December 31, 2026 | 193 days | Spans summer through year end |
| March 15, 2026 | March 15, 2027 | 365 days | One full non-leap year |
| February 28, 2024 | March 1, 2024 | 2 days | Leap day February 29 falls between these dates |
Notice the January-to-March span differs by exactly one day between 2024 and 2026 because of the leap year. That single day can matter when calculating notice periods, warranty coverage, or subscription billing.
How do you count days? Inclusive vs. exclusive
This is the most common source of confusion. When you count the gap from January 1 to January 3, do you get 2 or 3?
The answer depends on your convention:
- Exclusive of the end date (most common): Jan 1 to Jan 3 = 2 days. You count the days that pass, not the arrival day itself. This is how most date calculators and programming languages work.
- Inclusive of both endpoints: Jan 1 to Jan 3 = 3 days. Legal documents sometimes use this convention, particularly for notice periods ("within 30 days, inclusive").
When precision matters, read the document carefully. A 30-day notice period starting June 1 might mean the notice expires June 30 (exclusive) or July 1 (inclusive), depending on who wrote the contract.
Using a spreadsheet: DATEDIF and simple subtraction
Spreadsheets give you two reliable methods:
Simple subtraction
Put your start date in A1, end date in B1, then in C1 type =B1-A1. Format C1 as a number. The result is days elapsed, exclusive of the end date.
DATEDIF function
Type =DATEDIF(A1,B1,"D") for total days. This function also supports "M" for whole months and "Y" for whole years, which is handy when you need years-months-days broken out. Note: DATEDIF is not documented in newer Excel help files but still works in both Excel and Google Sheets.
What affects the count
Three things can shift the number and catch people off guard:
- Leap years. Any span crossing February of a leap year gets one extra day. Leap years are divisible by 4 (with century-year exceptions). 2024, 2028, and 2032 are all leap years.
- Time zones. If your start and end times are in different time zones, a date that looks the same on paper might actually represent a different moment. Date calculators that work with dates only (not times) sidestep this problem entirely.
- Daylight saving time. Clocks spring forward or fall back, adding or removing an hour. This matters only when you are counting hours, not calendar days.
Quick reference: days in each month
| Month | Days (normal year) | Days (leap year) |
| January | 31 | 31 |
| February | 28 | 29 |
| March | 31 | 31 |
| April | 30 | 30 |
| May | 31 | 31 |
| June | 30 | 30 |
| July | 31 | 31 |
| August | 31 | 31 |
| September | 30 | 30 |
| October | 31 | 31 |
| November | 30 | 30 |
| December | 31 | 31 |
Related guides
Once you have the day count, you might want to go further. See how to add days to a date for forward planning, or how many weeks between two dates if you need the answer in weeks.
Frequently asked questions
How do I calculate the number of days between two dates?
Subtract the earlier date from the later date. Each full calendar day equals 1. Use the date calculator on this site for instant results, or use =B1-A1 in a spreadsheet with both cells formatted as dates and the result cell formatted as a number.
How do you count days?
Start at zero on your starting date and add one for each day that passes. If the question asks you to include the starting day itself, add 1 to your total. Most tools and formulas use the exclusive convention where the end date is not counted.
Does January 1 to January 3 equal 2 days or 3 days?
Two days under the exclusive convention (which most calculators use). Three days if you count both endpoints. Check whether the context calls for inclusive or exclusive counting before relying on the answer.
What is the formula to find days between two dates in a spreadsheet?
In Excel or Google Sheets, type =DATEDIF(A1,B1,"D") or simply =B1-A1. Both return the number of calendar days from the earlier date to the later date, not counting the end date itself.
Does the month length matter when calculating days?
Yes. Months range from 28 to 31 days, so you cannot multiply months by a fixed number to get days. Always count actual calendar days or use a calculator that accounts for each month's real length.