/ Published in: Visual Basic
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Function workdayNumber(TheDate As Date) As Byte ' Determines the work day number within a month Dim tempDate As Date Dim tempWeekDay As Byte ' Start with the first day of the month tempDate = CDate(Format(TheDate, "m/1/yyyy")) Do While Month(tempDate) = Month(TheDate) tempWeekDay = Weekday(tempDate) If (tempWeekDay > 1) And (tempWeekDay < 7) Then workdayNumber = workdayNumber + 1 If tempDate = TheDate Then Exit Function End If End If tempDate = tempDate + 1 Loop End Function