Version: 2.0
-
Syntax:
- DateAdd(Interval, Number, Date)
- 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 settings in the Interval Settings table may be used.
- 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.
The DateAdd function adds a time interval to any date.
If you wish to use the current date or time, simply use the Date
or the Now functions.
Interval Settings
SETTING |
DESCRIPTION |
YYYY |
Year |
Q |
Quarter |
M |
Month |
Y |
Day
Of Year |
D |
Day |
W |
WeekDay |
WW |
Week Of Year |
H |
Hour |
N |
Minute |
S |
Second |
Examples
Code:
<% =Date %>
<% =DateAdd("WW", 6, Date) %>
Output:
3/16/99
4/27/99
Language(s):
VBScript
Code:
<% =Now %>
<% =DateAdd("S", 30, Now) %>
Output:
3/16/99 12:14:00 PM
3/16/99 12:14:30 PM
Language(s):
VBScript
Code:
<% ="1/1/2001" %>
<% =DateAdd("YYYY", 1000, "1/1/2001") %>
Output:
1/1/2001
1/1/3001
Language(s):
VBScript
See Also: