Any help with the syntax would be appreciated.
Datediff(day,dateOne, dateTwo) as TimeServed
How would I get the number of days between those dates excluding Saturday and Sunday? I do not have the ability to create functions.
Any help with the syntax would be appreciated.
Datediff(day,dateOne, dateTwo) as TimeServed
How would I get the number of days between those dates excluding Saturday and Sunday? I do not have the ability to create functions.
Please check out below code, it might help:
declare @firstdate Date
declare @seconddate Date
set @firstDate = convert(date, '2019-11-01')
set @seconddate = convert(date, '2019-11-30')
select ((datediff(dd, @firstDate, @secondDate)+1) -
( DateDiff(wk, @firstDate, @secondDate) * 2) -
case when datepart(dw, @FirstDate) = 1 then 1 else 0 end -
case when datepart(dw, @secondDate) = 7 then 1 else 0 end)