Search Tools Links Login

RemoveWeekEnds


Visual Basic 6, or VB Classic

Returns number of business days from a start date and total number of days. There are more pieces coming. Building a routine that calculates holidays and weekends to tell you strictly business days.

Original Author: UstesGreenridge

Inputs

strStartDate and totalsdays

Returns

total number of business days

Code

Public Function RemoveWeekends(strStartDate As String, intNumberOfDays) As Integer
  Dim i As Integer
  
  For i = 0 To intNumberOfDays
    Select Case Weekday(DateAdd("d", i, CDate(strStartDate)))
      Case vbSaturday, vbSunday
        intNumberOfDays = intNumberOfDays - 1
    End Select
  Next i
  RemoveWeekends = intNumberOfDays
End Function

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 91 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.