The DateAdd function adds the specified time interval to the date passed or subtracts it from the specified date. The resulting date is returned.
|
Syntax | ||||
|
DateAdd(Interval, Number, Date) | ||||
|
Return value | ||||
|
Type |
Description | |||
|
Double |
| |||
|
Parameter | ||||
|
Use |
Name |
Type |
Passing |
Description |
|
Required |
Interval |
String |
ByVal |
indicates the time interval to be added |
|
Required |
Number |
Double |
ByVal |
indicates the number of intervals to add. Here you can specify positive values for future data and negative values for past data |
|
Required |
Date |
Double |
ByVal |
The date to add a value to |
|
Interval |
Description |
|
yyyy |
Year |
|
q |
Quarter |
|
m |
Month |
|
y |
Day of the year |
|
d |
Day |
|
w |
Weekday |
|
ww |
Week |
|
h |
Hour |
|
n |
Minute |
|
s |
Second |
Number indicates the number of intervals to add. Here you can specify positive values for future data and negative values for past data.
Example
Dim Datum As Date
Datum := DateAdd("m", 1, DateSerial(2006, 1, 31))
Date now has the value February 28, 2006