How the gap is measured
The calculator moves forward from the earlier date in whole years, then whole months, then days. From March 1, 2024 to October 6, 2026: 2 years takes you to March 1, 2026, 7 more months to October 1, 2026, and 5 more days to October 6. The answer is 2 years, 7 months and 5 days, which is 949 days in total.
Months are not all the same length, so the days left over depend on where you start. Moving by one month from January 31 would land on a day that does not exist, so the last day of the shorter month is used: February 28, or February 29 in a leap year. Then the remaining days are counted from there. That is why January 31 to March 1 is 1 month and 1 day, and 29 days in total in 2023 or 30 in 2024.
Should the end date count?
Most spreadsheets and programming languages subtract: end date minus start date. That is the number of days that pass, or the number of nights in a stay. Monday to Friday is 4. Counting both days gives the number of calendar days a stay, course or project covers: 5. Neither is wrong, but they answer different questions.
- Leave it off for how long until a date, how old something is, or the number of nights.
- Switch it on when the wording says "inclusive", "including the last day" or "from the 1st to the 5th" for the days involved.
If a contract, form or rule gives the answer in words, follow its wording and use the switch to match.
Leap years, month ends and clock changes
Leap days are counted for you: January 1, 2024 to January 1, 2025 is 366 days, because 2024 contains February 29, while January 1, 2023 to January 1, 2024 is 365. A year is a leap year when it divides by 4, except century years, which must divide by 400. So 2000 was a leap year and 1900 was not.
Only calendar dates are used, never clock times. Daylight saving changes and time zones cannot add or remove an hour from the answer, and the hours figure is simply days × 24.
Dates are counted on the Gregorian calendar for every year, as computers do. Historical dates from before a country adopted it (1582 in some countries, 1752 in Britain and its colonies, later elsewhere) may not match the calendar that was in use at the time.
In a spreadsheet
In Excel or Google Sheets, a date is a number, so subtracting gives days: put the earlier date in A1 and the later one in B1, and =B1-A1 is the same count this calculator gives with the end date left out. Add 1 to include the end date. DATEDIF(A1,B1,"m") gives whole months. For working days only, use the working days calculator.