||//String expression that is the interval of time you want to add to date.
||//Numeric expression that is the number of intervals you want to add to date.
It can be positive (to get dates in the future) or negative (to get dates in
||//Date being added to or the name of a Variant of VarType 7 (Date). It can be
either short form (1/1/95) or long form (1-January-1995).
You can use the DateAdd function to add a specified time interval to or subtract a specified time interval from a date. For example, you can use DateAdd to calculate a date 30 days from today or a time that is 60 minutes from now.
The following table lists the valid time periods and their interval values.
|Day of year
TheDateAdd function will not return an invalid date. If you omit the year from date, DateAdd uses the current year. If date is enclosed by number signs (#), the current year becomes a permanent part of date. If you enclose date in double quotation marks (""), however, the current year is inserted in your code each time it is executed.
If the calculated date would precede the year 0 (that is, you subtract more years than are in date), an error occurs.
If number is not a Long value,DateAdd follows the rules for the Fix function and rounds number to the nearest whole number.
The following example adds one month to January 31:
AddMonth = DateAdd( "m", 1, #31-Jan-95# )
In this case, DateAdd returns 28-Feb-95, not 31-Feb-95. If date was 31-Jan-96, it would return 29-Feb-96 because 1996 is a leap year.