Calculating the number of days between two dates sounds simple, but calendars are irregular. Months have 28, 29, 30, or 31 days. Leap years add an extra day every four years. To count days accurately, the tool converts both dates to a single number β the number of milliseconds since January 1, 1970 β and subtracts one from the other.
Both dates are first normalized to midnight in your local time zone. Then their Unix timestamps are compared. The difference in milliseconds is divided by 86,400,000 (the number of milliseconds in a day) to get the number of calendar days between them.
The years/months/days breakdown works differently. Instead of dividing by fixed units, the tool subtracts the components individually β years first, then months, then days β borrowing from the next larger unit when a subtraction goes negative. This is why the "calendar days" result and the "years, months, days" result can look unrelated: one counts a flat number of days, the other shows a calendar-based difference.
Business days skip weekends (Saturday and Sunday). To count them, the tool walks through every day in the range and checks the day of the week. Any day from Monday to Friday adds to the weekday count; Saturday and Sunday add to the weekend count.
Note that this doesn't exclude public holidays. If you need to know the exact number of working days between two dates (excluding holidays like Christmas or New Year's), you'd need to subtract those manually or use a calculator configured for a specific country's holiday calendar.
Adding or subtracting months and years is trickier than it sounds. If you add 1 month to January 31, what's the result? February 28 (clamping to the last day of the shorter month) is the most common answer. The tool uses this clamping behavior, which is what most spreadsheet programs do as well.
Adding years to a leap day (February 29) uses similar logic. If you add 1 year to February 29, 2024, the result is February 28, 2025 β since 2025 isn't a leap year.