Lotus Notes FAQ Visit Our Sponsor!

How do I calculate the number of weekdays between two date fields?


The following formula counts the number of weekdays (but not weekend days):
diffDays := (EndDate - StartDate) / 86400 + 1;
strtDay := @Modulo(@Weekday(StartDate); 7);
endDay := @Modulo(@Weekday(EndDate); 7);
result := (diffDays - endDay + strtDay - 8) * 5 / 7 - @Max(-2; -strtDay) - @Min(1; endDay) + 5 - strtDay + endDay

Applies to Notes Versions: 3, 4, 4.5, 4.6, 5
Last Modified: January 6, 1998