Posted By

Scooter on 09/02/10


Tagged

DateTime


Versions (?)

Number of working days in a month


 / Published in: ASP
 

URL: http://reusablecode.blogspot.com/2010/09/number-of-working-days-in-month.html

Returns the number of working days in a month. Does not take holidays into consideration. I needed this function for the purposes of calculating employee annual salary, and holidays are paid days anyway. Requires my MonthDays and isLeapYear functions.

  1. Function WorkingDays(someYear, someMonth)
  2. WorkingDays = 0
  3.  
  4. For i = 1 To MonthDays(someYear, someMonth)
  5. If Weekday(DateSerial(someYear, someMonth, i)) <> 1 And Weekday(DateSerial(someYear, someMonth, i)) <> 7 Then
  6. WorkingDays = WorkingDays + 1
  7. End If
  8. Next
  9. End Function

Report this snippet  

You need to login to post a comment.