How to Use the DateAdd function in ASP
Note that the vbs and SQL statements are slightly different. The following post provides vbs help.
SQL searchable SQL built-in help documentation
String expression, indicating the time interval to be added. For values, see "Settings.
Returns the date of the specified interval.
DateAdd (interval, number, date)
Parameters
Interval
Required.
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. Variant or the text that represents the date to add interval.
Set
The interval parameter can have the following values:
Table
Description
The DateAdd function can be used to add or subtract a specified time interval from a date. For example, you can use DateAdd to start from the day 30 days later or 45 minutes later than the current day. To add a time interval in the unit of "day" To date, you can use "day of the year" ("y"), "day" ("d ") or "the number of days in a week" ("w ").
The DateAdd 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, DateAdd returns February 28, instead of February 31, 95. If date 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.
If the number is not a Long value, the first rounding is the nearest integer.
Datediff is similar