שתף באמצעות


How to Use DateAdd and exclude WeekEnds

Question

Thursday, September 16, 2010 7:05 PM

Hello All,

I am trying to compute time off, I have a datetimepicker which allow user to select a day he wishes to start leave and a textbox to specify no of days applying for.

Now I wand to use dateadd function to calculate resumption date excluding Weekends, but the no of days applying for must complete pls help!

Thanks in advance

 

All replies (2)

Thursday, September 16, 2010 7:28 PM ✅Answered

You can use DateInterval.Weekday to add just a certain number of weekdays. E.g.

Dim returnDate = DateAdd(DateInterval.Weekday, numDays, startDate)

However, it gets more complicated if you want to skip holidays as well.


Thursday, September 23, 2010 5:53 AM

Hello shyner.neter,

Thanks for your post.

Blackwood has given you helpful suggestion. When you come back, please have a try. If you think it provides no help, please unmark and follow up.

Best regards,
Liliane
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com

Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. Thanks