How to calculate last business day of month in VBScript

reporting-servicesvbscript

How do I calculate the last business day of month in VBScript? It is for a Reporting Services report.

Thanks

Best Answer

How about:

intMonth=11
'Use zero to return last day of previous month '
LastDayOfMonth= dateserial(2008,intMonth+1,0)

'Saturday '
If WeekDay(LastDayOfMonth,1)=7 Then LastDayOfMonth=LastDayOfMonth-1
'Sunday '
If WeekDay(LastDayOfMonth,1)=1 Then LastDayOfMonth=LastDayOfMonth-2

Msgbox LastDayOfMonth & "  " & Weekdayname(Weekday(LastDayOfMonth,1),1)
Related Topic