VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Function that counts the difference between two dates excluding one day in a week (for example sund

by theg (1 Submission)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 3rd September 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Function that counts the difference between two dates excluding one day in a week (for example sunday - non-working day)

Rate Function that counts the difference between two dates excluding one day in a week (for example sund



Dim tmpDate As Date

    DateDifference = 0
    S = 0
    tmpDate = vbFirstDate
    Do
    
        Select Case DateTime.Weekday(tmpDate)
        
        Case vbExcludeDay                           'Skip excluded day

        Case Else
            DateDifference = DateDifference + 1     'If not excluded day inc
        End Select                                  'by one
        
    tmpDate = tmpDate - 1
    Loop Until tmpDate = vbSecondDate

End Function

Download this snippet    Add to My Saved Code

Function that counts the difference between two dates excluding one day in a week (for example sund Comments

No comments have been posted about Function that counts the difference between two dates excluding one day in a week (for example sund. Why not be the first to post a comment about Function that counts the difference between two dates excluding one day in a week (for example sund.

Post your comment

Subject:
Message:
0/1000 characters