Description
Returns a date to which a specified time interval has been added.
Syntax
DATEADD ( interval, number, StartDate )
Parameter | Description |
---|---|
interval | String expression that is the interval of time to add. Interval can be one of the following values:
|
number | Numeric expression that is the number of intervals to add. It can either be positive (to get dates in the future) or negative (to get dates in the past). |
StartDate | Date to which the interval is added. |
Remarks
Use the DATEADD function to add 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 45 minutes from now.
The DATEADD function will not return an invalid date. For example, DATEADD("m", 1, "31-Jan-10") returns 28-Feb-10, not 31-Feb-10. If the date is 31-Jan-12, it returns 29-Feb-12 because 2012 is a leap year.
If the calculated date would precede the year 100 (that is, subtract more years than are in date), an error occurs.
Weekday
The "w" interval includes all the days of the week, Sunday through Saturday, not just the workdays, Monday through Friday. When you use "w" to add days to a date, the DateAdd function adds the total number of days that you specified to the date.