How to calculate working days between two dates correctly

Counting business days is not as simple as dividing calendar days by 7. Weekends, public holidays, and partial days at the boundary all need careful handling.

A working day (also called a business day) is typically Monday through Friday, excluding public holidays. Counting working days between two dates requires knowing both the weekday pattern and the relevant holiday calendar, which varies by country and sometimes by region within a country.

The basic algorithm: count the total calendar days between the dates, subtract the weekend days, then subtract public holidays that fall on weekdays. For a date range of 14 calendar days starting on Monday, there are 2 full weekends (4 days) = 10 weekdays. If a public holiday falls on one of those weekdays, you have 9 working days.

The mathematics of weekday counting

For any date range, the number of weekends can be calculated using modular arithmetic. Given a start day of week (0 = Monday, 4 = Friday, 5 = Saturday, 6 = Sunday) and a total span of N calendar days, you can count exactly how many Saturdays and Sundays fall in the range without iterating through each day. This is what working days calculators do internally — it's faster than looping through every date.

The boundary matters: does the start date count? Does the end date count? Convention varies: financial settlement often counts the start date but not the end; HR systems for employment duration often count both. Always verify which convention applies in your context before relying on a working days count for a deadline or contract.

Public holidays and country-specific rules

The same calendar day can be a working day in one country and a public holiday in another. Christmas Day (December 25) is a public holiday in most Western countries but a normal working day in Japan. The Islamic world observes Eid al-Fitr and Eid al-Adha, whose exact dates shift by 11 days each year relative to the Gregorian calendar because they follow the lunar Islamic calendar.

Some industries have their own holiday calendars. Financial markets follow exchange-specific schedules that may differ from government holidays. In the US, markets are open on Columbus Day (now Indigenous Peoples Day) but closed on Good Friday — neither of which is a universal federal holiday pattern. When computing working days for financial contracts, always use the specific settlement calendar for the relevant market.