Practical guide
Date differences, hours and age — how can off-by-one errors be avoided?
Date calculations depend on whether you need elapsed time, a count of calendar days or inclusive dates. Always name the chosen convention before using the result.
Elapsed time excludes the starting instant
One day passes from 1 January to 2 January. If a task counts both attendance or event dates, one may need to be added to the ordinary difference.
The date-difference tool shows elapsed time and a calendar breakdown, not working days.
A clock interval can cross midnight
When the end clock is earlier than the start, the interval may end on the next day. An explicit choice prevents a negative result.
Only deduct a break when it is outside net time. Time zones and daylight-saving changes require complete dates.
Age uses complete calendar periods
Complete years increase on a birthday. Months vary in length, so dividing days by 365 or 30 does not produce exact calendar age.
Special legal procedures may define attainment of age differently and require review of their legal basis.
Frequently asked questions
What does this guide explain about “Elapsed time excludes the starting instant”?
One day passes from 1 January to 2 January. If a task counts both attendance or event dates, one may need to be added to the ordinary difference. The date-difference tool shows elapsed time and a calendar breakdown, not working days.
What does this guide explain about “A clock interval can cross midnight”?
When the end clock is earlier than the start, the interval may end on the next day. An explicit choice prevents a negative result. Only deduct a break when it is outside net time. Time zones and daylight-saving changes require complete dates.
What does this guide explain about “Age uses complete calendar periods”?
Complete years increase on a birthday. Months vary in length, so dividing days by 365 or 30 does not produce exact calendar age. Special legal procedures may define attainment of age differently and require review of their legal basis.
Calculators covered by this guide
Date difference calculator
Calculate total days and calendar difference between two dates.
Hours and time calculator
Calculate time between clocks, across midnight and after deducting a break.
Age calculator
Calculate complete age in years, months and days on a selected date.