FUNCTION: DateAdd( )
DateAdd(Interval, Number, Date)
The DateAdd function adds a time interval to any date.
There are three mandatory arguments.
Interval
The Interval argument defines the the type of time interval you wish to add
onto the date.
You must place the setting inside double quotes.
Only the following settings may be used.
SETTING | DESCRIPTION |
YYYY | Year |
Q | Quarter |
M | Month |
Y | Day Of Year |
D | Day |
W | WeekDay |
WW | Week Of Year |
H | Hour |
M | Minute |
S | Second |
Number
The Number argument is a multiplier for the Interval argument (i.e., how many days, weeks, months, etc.).
If this is a positive number, you will go forward in time. A negative number will go back in time.
Date
The Date argument is a date or time.
If you wish to use the current date or time, simply use the Date or the Now functions.
Code:
<% =Date %>
<% =DateAdd("WW", 6, Date) %>
Output:
3/16/99
4/27/99
Code:
<% =Now %>
<% =DateAdd("S", 30, Now) %>
Output:
3/16/99 12:14:00 PM
3/16/99 12:14:30 PM
Code:
<% ="1/1/2001" %>
<% =DateAdd("YYYY", 1000, "1/1/2001") %>
Output:
1/1/2001
1/1/3001