Results 1 to 18 of 18

Thread: Adding working days to date

Threaded View

  1. #8
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    Re: Adding working days to date

    Just another link but it looks promising:

    http://www.codeproject.com/Articles/...Days-to-a-Date

    I just tested it and it seems to work OK. Very similar to what is already posted.

    Code:
    Public Function CalculateTenBusinessDaysFromInputDate(ByVal StartDate As Date) As Date
            'This simply adds at least 2 full weeks to the start date.
    
            Select Case StartDate.DayOfWeek
    
                Case DayOfWeek.Sunday
                    'if the start date is not a sunday you need to add 
                    '1 day to push it to a monday that is why the number is 15.
                    Return StartDate.AddDays(15)
                Case DayOfWeek.Monday, DayOfWeek.Tuesday, _
                DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday
                    'if the start date is any other day then just add 14 days to the start date.
                    Return StartDate.AddDays(14)
                Case DayOfWeek.Saturday
                    'if the start date is on a Saturday you need to add 
                    '2 days to push it to a monday that is why the number is 16.
                    Return StartDate.AddDays(16)
                Case Else
                    Return StartDate
    
            End Select
    
        End Function
    Last edited by TysonLPrice; May 1st, 2013 at 10:30 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width