DateAdd Function
Returns the date of the specified interval.
DateAdd(interval, number, date)
Parameters
Interval
Required. String expression, indicating the time interval to be added. For values, see the "Settings" section.
Number
Required. Numeric expression, indicating the number of time intervals to be added. A numeric expression can be a positive number (to get the future date) or a negative number (to get the past date ).
Date
Required.VariantOr you want to addInterval.
Set
IntervalParameters can have the following values:
Set |
Description |
Yyyy |
Year |
Q |
Quarter |
M |
Month |
Y |
Number of days per year |
D |
Day |
W |
Number of days in a week |
Ww |
Week |
H |
Hours |
N |
Minutes |
S |
Seconds |
Description
AvailableDateAddThe function adds or removes the specified time interval from the date. For example, you can useDateAddThe date 30 days later than the current day or 45 minutes later than the current day. To forwardDateAdd the time interval in the unit of "day". You can use "day of the year" ("y") and "day" ("d ") or "number of days in a week" ("w ").
DateAddThe function does not return an invalid date. In the following example, we will add a month to April January 31:
NewDate = DateAdd("m", 1, "31-Jan-95")
In this example,DateAddReturn February 28, instead of February 31. IfDateIf the value is January 31, the return value is February 29, because 1996 is a leap year.
If the calculation date is before January 1, 100 AD, an error occurs.
IfNumberNoLongType value, the first rounding is the nearest integer.