435,061 Members | 1,523 Online
Need help? Post your question and get tips & solutions from a community of 435,061 IT Pros & Developers. It's quick & easy.

# Urgent : How to calculate next X working day

 100+ P: 284 i am using vb6. what i need is to calculate X (means any ) working day date skipping holidays (saturday and sunday) or (friday or saturday in some contries) for example: today is 20-06-2008 and its friday (the holidays will be saturday and sunday) now if i say 2 working days so it should give me anwer 24-06-2008 that is adding 4 days to 20-06-2008 (2 holidays and 2 working days) so how to achive this task i have to do this as soon as possible because i had stuck in this. Jun 21 '08 #1
4 Replies

 Expert 100+ P: 2,364 Hey there neighbour! You might need to tell us a little more, it sounds like you have something working already, would you mind posting it? Wishing you a good luck with this one... Have you also tried searching our forum firsthand, there may have been something posted. Dököll Jun 21 '08 #2

 100+ P: 284 i had searched the forum but not get exactly what i want i want to calulate the date of upcoming x (means any ) working day the problem is how could i now that after let say 10 working days what is the day is Hey there neighbour! You might need to tell us a little more, it sounds like you have something working already, would you mind posting it? Wishing you a good luck with this one... Have you also tried searching our forum firsthand, there may have been something posted. Dököll Jun 22 '08 #3

 Expert 100+ P: 1,445 Hi, Try This Code: Expand|Select|Wrap|Line Numbers     Dim i As Integer     Dim TDate As Date     Dim NDays As Integer     NDays = 2     i = NDays     TDate = Date     Do         TDate = TDate + 1         If Val(Format(TDate, "W")) = 1 Or Val(Format(TDate, "W")) = 7 Then              'Checking For Saturday and Sunday         Else             i = i - 1         End If     Loop Until i = 0     MsgBox "Next Working date After " & NDays & " Is " & TDate   Change NDays for Number of days.. Regards Veena Jun 22 '08 #4

 100+ P: 284 yes qveen its is working properly. Thanks Hi, Try This Code: Expand|Select|Wrap|Line Numbers Dim i As Integer Dim TDate As Date Dim NDays As Integer NDays = 2 i = NDays TDate = Date Do TDate = TDate + 1 If Val(Format(TDate, "W")) = 1 Or Val(Format(TDate, "W")) = 7 Then 'Checking For Saturday and Sunday Else i = i - 1 End If Loop Until i = 0 MsgBox "Next Working date After " & NDays & " Is " & TDate   Change NDays for Number of days.. Regards Veena Jun 22 '08 #5