Hello,
Without creating an additional table and with the least amount of code, I'm looking for a way to determine the number of business days in a given month.
Thanks
Hello,
Without creating an additional table and with the least amount of code, I'm looking for a way to determine the number of business days in a given month.
Thanks
Number Of Business Days
jtallard
I am using this query to get amount of business days (days from mon to fri)
set datefirst 1
declare @sdate datetime
declare @edate datetime
select @sdate = '20070516' --for example, start date May, 16th
select @edate='20070531' --end date May, 31st
select datediff(day, @sdate, @edate)+1-(
select (case datepart(dw, @sdate)
when 7 then (datepart(ww, @edate)-datepart(ww, @sdate))*2-1
else (datepart(ww, @edate)-datepart(ww, @sdate))*2
end)+
(case datepart(dw, @edate)
when 6 then 1
when 7 then 2
else 0
end)
)
dragoncells
My apologies. Standard business days as viewed by most American businesses. Mon-Fri excluding holidays where businesses would typically be closed.
Rajesh Ladda
Fair enough; sorry for being too rammy.
Jonathan Lavon
Man.
Is this list of holidays the ones that you mean
Promit
Synergy:
Your question contains a huge amount of subjectivity. What is your view of what constitutes a business day Do you mean every Monday through Sunday Exclude New Years day Ground Hogs day More information in this case is necessary.
pigi76
Todd Biggs - Windows Live
Synergy:
I agree with Umachandar. I have implemented a number of business day calculation functions with all of them based on a calendar table. I re-tooled a function I once messed around with. I think it performs rather mediocre, but you really seemed to be asking for a starting point and this routine might be of some value.
ssfftt