How to calculate the number of days between two dates
✓ Verified in LibreOffice 25.8.7.3Find how many days (or months/years) fall between a start date and an end date.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel | =DATEDIF(A2,B2,"d") | Days. Use "m" for whole months, "y" for years. Or simply =B2-A2 for days. |
| Google Sheets | =DATEDIF(A2,B2,"D") | Same; Sheets accepts "D"/"M"/"Y". |
| LibreOffice Calc | =DATEDIF(A2,B2,"d") | Supported in all versions. |
How it works
DATEDIF(start, end, unit) returns the difference in the chosen unit: "d" days, "m" months, "y" years. Jan 1 to Mar 1 2024 (a leap year) is 31 + 29 = 60 days. For plain days you can also just subtract: =end-start.
Verified, not just documented
We ran =DATEDIF(DATE(2024,1,1),DATE(2024,3,1),"d") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 60 — exactly the expected result. Every formula here is confirmed by actually executing it.