By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
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