By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
StartDate is the early date and EndDate is the ending date (obviously). This
will not take any holiday/vacation days into account. You could add extra code
to access a holiday schedule and add that into the calculation.
diffDays := (EndDate - StartDate) / 86400;
strtDay := @Modulo(@Weekday(StartDate); 7);
endDay := @Modulo(@Weekday(EndDate); 7);
weekdays := (diffDays - endDay + strtDay - 7) * 5 / 7 - @Max(-2; -strtDay) -
@Min(1; endDay) + 5 - strtDay + endDay