Calculate Number of Business Days between Two Dates

var startDate = “23-SEP-2022”;
startDate = new Date(startDate.replace(/-/g, “/”));
var endDate = “”, noOfDaysToAdd = 2, count = 0;
while(count < noOfDaysToAdd){
endDate = new Date(startDate.setDate(startDate.getDate() + 1));
if(endDate.getDay() != 0 && endDate.getDay() != 6){
count++;
}
}

Leave a comment

Your email address will not be published. Required fields are marked *