The one-line formula
Days between two dates, exclusive of the start date, is the end date minus the start date. That is it. If you want both endpoints counted, add 1. Every date calculator, spreadsheet, and programming language implements the exclusive version first, because date subtraction is defined that way: June 1 minus June 1 is zero days, June 2 minus June 1 is one day.
For January 1, 2026 to December 31, 2026: December 31 minus January 1 is 364 days exclusive. Count both endpoints and you get 365, which matches the length of a non-leap year. The two answers differ by exactly one, and that one is the entire source of date-math arguments.
Exclusive vs inclusive: which one do you need
Use the exclusive count when you are measuring elapsed time: how long a project took, how old something is, how many days remain until an event. If you were born on October 4 and today is October 4, zero days have elapsed, not one. Countdowns, ages, and durations all use the exclusive convention.
Use the inclusive count when you are counting occupied days: nights in a hotel, days of a subscription, days worked on a timesheet. A trip from Friday to Sunday occupies three days, even though Sunday minus Friday is two. Legal notice periods are the classic trap: a "10-day notice served on the 1st" may mean the deadline is the 10th (inclusive) or the 11th (exclusive), depending on the jurisdiction and the wording. When the stakes matter, name the exact end date in writing instead of a bare day count.
Worked example 1: a full year
Start: January 1, 2026. End: December 31, 2026. Exclusive: December 31 minus January 1 = 364 days. Inclusive: 364 + 1 = 365 days. Sanity check: 2026 is not a leap year, so a full calendar year is 365 days, which matches the inclusive count. When you are counting "all of 2026," you want the inclusive number.
Worked example 2: a holiday countdown
Start: October 4, 2026. End: December 25, 2026. Count the remaining days in October after the 4th: October has 31 days, so 31 minus 4 = 27 days. Add November (30 days) and the first 25 days of December: 27 + 30 + 25 = 82 days. There are 82 days until Christmas from October 4, exclusive. If you count today as day one, it is 83. Most countdowns use the exclusive version, so say 82.
Worked example 3: a project window
Start: October 4, 2026. End: April 2, 2027. October remainder: 27 days. Then November 30, December 31, January 31, February 28 (2027 is not a leap year), March 31, plus April 2: 27 + 30 + 31 + 31 + 28 + 31 + 2 = 180 days. The project window is exactly 180 days, which is why date-range queries like "180 days from today" return April 2, 2027 when asked on October 4, 2026.
Leap years: where hand math goes wrong
Any range that crosses February 29 picks up an extra day. A leap year is any year divisible by 4, except century years, which must also be divisible by 400. So 2024 and 2028 are leap years, 2000 was, and 2100 will not be. If you hand-count days between March 2023 and March 2025, you must include the 29 days of February 2024 or your answer is short by one. This is the single most common hand-count error, and the reason to let a calculator handle multi-year ranges.
Doing it in Excel or Google Sheets
In a spreadsheet, subtract the cells: with the start date in A1 and the end date in B1, =B1-A1 gives the exclusive count. For the inclusive count use =B1-A1+1. The DATEDIF function does the same: =DATEDIF(A1,B1,"d"). DATEDIF is an undocumented legacy function in Excel, but it works in both Excel and Google Sheets. Make sure both cells are formatted as dates, not text, or you will get a #VALUE! error. For business days only, use =NETWORKDAYS(A1,B1), which counts weekdays including both endpoints.
Common mistakes
The off-by-one is the king of date mistakes: forgetting whether the start date counts. The fix is to test your convention on a trivial case first. If your method says Monday to Tuesday is 2 days, you are counting inclusively; if it says 1, exclusively. Pick the convention your contract or policy requires and stay consistent.
Time zones are the second trap. Date subtraction across midnight in different zones can shift a day. A deadline of "October 4" in New York is still October 3 in Los Angeles until 3 AM Eastern. When the exact day matters, anchor the deadline to one explicit time zone and write it down.
Daylight saving time does not affect calendar-day math, because you are counting whole days, not hours. It only matters for hour-level precision, like a 24-hour cancellation window that spans a spring-forward Sunday.