0

I browsed google and found nothing so thought i would put my efforts up here.
hope this all helps.

this function will allow you to return the number of days between two dates minus saturdays and sundays. (including the start date)

// ########## startMonth and endMonth both start at 0 i.e 0 = january, 1 = feb etc
function getDaysMinusWeekend(startDay, startMonth, startYear, endDay, endMonth, endYear) {
	var sdate = new Date();
	var edate = new Date();
	var odays = 0;
	var total = 0;

	sdate.setFullYear(startYear,startMonth,startDay);
	edate.setFullYear(endYear,endMonth,endDay);

	odays = 6 - sdate.getDay();
	if(odays == 6) {
		odays = 0;
	}

	sdate.setFullYear(startYear,startMonth,startDay + odays);

	return Math.floor(((((edate.getTime() - sdate.getTime()) / 1000 / 60 / 60 / 24) / 7) * 5) + 

odays);
}
2
Contributors
1
Reply
4
Views
9 Years
Discussion Span
Last Post by achelalsharma
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.