Date Difference Calculator
Count the days between two dates, in calendar days or working days only, or take a date and add or subtract any interval to find another.
Difference
0 y 1 m 0 d
- Total days
- 31
- Weeks
- 4
- Working days
- 22
- Hours
- 744
days elapsed between them
counts both ends, skips weekends
About the Date Difference Calculator
Counting days between two dates is arithmetic that a computer should never get wrong, and computers get it wrong constantly. The reason is that a day is not a fixed length of time. Twice a year, in most of the world, one day is 23 hours long and another is 25. Any calculation that divides the millisecond difference by 86,400,000 produces an off-by-one error around each clock change, and the bug appears twice a year for a couple of days and then disappears again.
This tool counts calendar dates rather than elapsed milliseconds, so daylight saving cannot affect the result. Leap years are handled by the same mechanism: February 2024 has twenty-nine days because the calendar says so, not because a constant was adjusted.
Business days are counted a day at a time rather than with a formula. The closed-form version is a well-known source of off-by-one errors at the boundaries, particularly when the range starts or ends on a weekend, and the day-by-day approach is fast enough for any span anyone will actually ask about.
The add-and-subtract mode has its own subtlety. Adding one month to 31 January cannot produce 31 February, so the result is clamped to the last day of the target month rather than rolling forward into March. JavaScript's own date handling rolls over silently, which is why so many subscription renewals and reminder systems land on the wrong date at the end of a long month.
Everything runs in your browser.
Frequently asked questions
What is 31 January plus one month?
28 February, or the 29th in a leap year. There is no 31 February, so the result is clamped to the end of the month. JavaScript rolls over to 3 March instead, which is behind a great many wrong renewal dates.
Are both dates included in the business day count?
Yes. Monday to Friday counts as five working days. Adding a weekend to either end adds nothing.
Does daylight saving affect the result?
No. Calendar dates are counted rather than elapsed milliseconds, so a 23-hour day cannot shift the total. Tools that divide by 86,400,000 are off by one around each clock change.
You might also need
- Time & date
Age Calculator
Exact age in years, months and days, plus the countdown to the next birthday.
- Time & date
Timezone Meeting Planner
Line up several cities on one 24-hour strip and find the hours that work for everyone.
- Developer
Unix Timestamp Converter
Convert between Unix timestamps and human dates, with the unit detected automatically.