Count the business days in XPages

There’s no @Businessdays formula function available in XPages, so if you have to count the business days between two date time values, you will have to implement your own way. Here’s the SSJS snippet that I have written to do the functionality of @Businessdays in case and anyone might need

Lotus notes domino

function businessDays(beginDate:NotesDateTime, endDate:NotesDateTime){
	var numberOfDays = 0;
	var dateCount:NotesDateTime = beginDate;
	var dayOfWeek:Integer;
	while(dateCount < endDate)
	{
 
		dayOfWeek = @Weekday(dateCount.getDateOnly());
		//don't count the weekends
		if (!(dayOfWeek == 1 || dayOfWeek == 7))
		{
			numberOfDays++;
		}
		dateCount.adjustDay(1);
	}
	return numberOfDays;
}

Related posts:

Share

About number.0