VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Function takes a date and adds a variable number of business days to the date. So if you pass in to

by Chris Beckingham (6 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 6th June 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Function takes a date and adds a variable number of business days to the date. So if you pass in today and 5, it returns the date that is five

Rate Function takes a date and adds a variable number of business days to the date. So if you pass in to



'  SUBROUTINE       :   AddBusinessDays
'  DESCRIPTION      :   Adds a number of business days to a date and returns the result
'  INPUTS           :   byval adtDate as Date - Initial date
'                   :   byval alDays as long  - Number of days to add
'  OUTPUTS          :   RetVal   - New date
'  REVISIONS        :   1.0.0 CB 04/01/2001 Original version.


Public Function AddBusinessDays(ByVal adtDate As Date, ByVal alDays As Long) As Date
    Dim ldtNewdate As Date
    Dim llLoop As Long
    llLoop = alDays
    
    ldtNewdate = adtDate
    Do Until llLoop <= 0
        ldtNewdate = ldtNewdate + 1
        
        Select Case Format(ldtNewdate, "w")
            Case 2, 3, 4, 5, 6
                llLoop = llLoop - 1
        End Select
    Loop
    
    AddBusinessDays = ldtNewdate
End Function

Download this snippet    Add to My Saved Code

Function takes a date and adds a variable number of business days to the date. So if you pass in to Comments

No comments have been posted about Function takes a date and adds a variable number of business days to the date. So if you pass in to. Why not be the first to post a comment about Function takes a date and adds a variable number of business days to the date. So if you pass in to.

Post your comment

Subject:
Message:
0/1000 characters