SDU Tools: DateDiffNoWeekends
There is a SQL Server T-SQL function that calculates the number of days (or months, or years, or other time periods) between any two dates.
SELECT DATEDIFF(day, ‘firstdate’, ‘seconddate’);
But I regularly get asked how to work out the number of days between two dates, excluding the weekends (Saturday and Sunday).
I’ve seen a few functions around that do a pretty good job at this but many don’t work properly if you have DATEFIRST changed in your session ie: if you change the first day of the week.
2017-11-15
 
				
