Days Between Dates
Days apart, with working days alongside.
Days apart, with working days alongside.
How to use it
- Enter both dates. Written as YYYY-MM-DD, which is the only order that means the same thing everywhere.
- Decide whether both ends count. Off gives the gap between them. On gives how many days the range covers.
- Read the rows. Days, weeks and working days, plus the weekday each date falls on.
When you would use this
Counting days between two dates is arithmetic that goes wrong in two specific ways, and both are handled here rather than assumed. The first is the off by one. Monday to Friday is four days apart and covers five days, and which one you want depends entirely on what you are counting. A gap between two events is the first. A booking, a holiday, a notice period is the second. This makes it a switch instead of picking one and hoping. The second is daylight saving. Subtracting two local timestamps and dividing by the length of a day gives a fractional answer twice a year, because a day with a clock change in it is 23 or 25 hours long, and the rounding lands on the wrong number. Working in whole calendar days at UTC midnight removes the problem rather than compensating for it. A date is a label on a calendar, not a moment. Working days are counted alongside, Monday to Friday. Public holidays are left out because they differ by country and region, and a tool that silently applied one country's calendar to your dates would be worse than one that leaves it to you.
Questions
- Why does the answer change by one when I turn on Count both ends?
- Because the two questions are different. Monday to Friday is four days apart and covers five days. A booking, a holiday or a notice period usually means the second one, and the gap between two events usually means the first. Neither is more correct, which is why it is a switch rather than a decision made for you.
- What counts as a working day?
- Monday to Friday. Public holidays are not deducted, because they differ by country and by region and guessing yours would be worse than leaving them to you.
- Does daylight saving affect the count?
- No. The arithmetic runs on whole calendar days at UTC midnight, so a clock change cannot make a day 23 hours long and round the total to the wrong number. That is a real bug in tools that subtract two local timestamps.