<-- Previous || Up || Next -->

Add Business Days Function
Dates Times Class

Public Function AddBusinessDays( _
      ByVal vDate As Variant _
    , ByVal vAddBusinessDays As Variant _
    ) As Variant

Add a number of business days to a date or subtract a number of business days from a date.

Examples:
    Weekday#1/15/2102#) = vbSunday
    AddBusinessDays(#1/15/2102#, -2) = #1/12/2102# ' Thu.
    AddBusinessDays(#1/15/2102#, -1) = #1/13/2102# ' Fri.
    AddBusinessDays(#1/15/2102#,  0) = #1/13/2102# ' Fri.
    AddBusinessDays(#1/15/2102#,  1) = #1/16/2102# ' Mon.
    AddBusinessDays(#1/15/2102#,  5) = #1/20/2102# ' Fri.
    Weekday(#1/16/2102#) = vbMonday
    AddBusinessDays(#1/16/2102#, -2) = #1/12/2102# ' Thu.
    AddBusinessDays(#1/16/2102#, -1) = #1/13/2102# ' Fri.
    AddBusinessDays(#1/16/2102#,  0) = #1/16/2102# ' Mon.
    AddBusinessDays(#1/16/2102#,  1) = #1/17/2102# ' Tue.
    AddBusinessDays(#1/16/2102#,  5) = #1/23/2102# ' Mon.
See also:
    NextDayOfWeek Function
    PreviousDayOfWeek Function
    AgeDifference Function
vDate: The date to which a number of business days are added. Function returns Null if vDate is Null or cannot be fixed up to a Date. The time component of vDate (if any) is ignored.
vAddBusinessDays: The number of business days to be added to vDate. Function returns Null if vDate is Null or cannot be fixed up to a number. vAddBusinessDays can be negative, in which case a number of business days will be subtracted from vDate. vAddBusinessDays is rounded to the nearest integer.
Special case: If vAddBusinessDays is 0 (zero), and vDate is a weekend day (Saturday or Sunday), then this function will return the previous business day (that would be the same as calling the function with a vAddBusinessDays value of -1).
v2.0 BugFix: Corrected a bug with this function so that it will work correctly when vAddBusinessDays is a negative number.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.