Add a specified time interval to a date.
Syntax DateAdd(interval, number, date) Key interval The interval of time to add. number The number of intervals to add. positive for dates in the future or negative for dates in the past. date The date to which the interval is added.
Interval Setting | Description |
yyyy | Year |
q | Quarter |
m | Month |
y | Day of year |
d | Day |
w | Weekday |
ww | Week |
h | Hour |
n | Minute |
s | Second |
DateAdd won't return an invalid date.
The DateAdd() function can be used in VBA or in an SQL query.
Examples
In a query:
In VBA:
Add one month to January 31:
DateAdd("m", 1, "31-Jan-16")
In this case, DateAdd returns 29-Feb-16
“Beauty is Nature's coin, must not be hoarded, but must be current” ~ John Milton
Related:
Date - Return the current date.
DateDiff - Return the time difference between two dates.
DatePart - Return part of a given date.
DateSerial - Return a date given a year, month, and day.