VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Calculate number of working days between two given dates

by Paresh Khond (2 Submissions)
Category: Math/Dates
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 26th July 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Calculate number of working days between two given dates

Rate Calculate number of working days between two given dates



''Calculates no of working days between two dates*****
''Use Two Date Pickers for two dates
''Label to display no of working days

Private Sub DTPicker1_Change()
DTPicker2_Change
End Sub

Private Sub DTPicker2_Change()
Dim c, dt,i,j

d1 = Format(DTPicker1.Value, "dd/mm/yyyy")
d2 = Format(DTPicker2.Value, "dd/mm/yyyy")
c = DateDiff("d", d1, d2)
For i = 1 To c + 1
  dt = Format(d1, "dddd")
       If dt <> "Sunday" Then
          j = j + 1
      End If
  d1 = DateAdd("d", 1, d1)
Next
Label.Caption = j
End Sub


Download this snippet    Add to My Saved Code

Calculate number of working days between two given dates Comments

No comments have been posted about Calculate number of working days between two given dates. Why not be the first to post a comment about Calculate number of working days between two given dates.

Post your comment

Subject:
Message:
0/1000 characters