Features
Ask DevGuru
ASP Resources
Find the Bug
Knowledge Base
Links
Tips of the Week
Tutorials
Products
dgCalendar
dgCharge New!
dgChart New!
dgFileUpload
dgReport New!
dgSort
dgTree
Site
Authoring
Coming Soon
DevGuru Resume
Link to Us
Merchandise
Sponsorships
Testimonials
What's New
Technologies
ADO 2.6
ASP
CSS2
HTML
JavaScript
Jet SQL
Transact-SQL Syntax
VBScript
WML
WMLScript
WSH
XML DOM
All Functions
CDate Function
Date Function
DateAdd Function
DateDiff Function
DatePart Function
DateSerial Function
DateValue Function
Now Function
Time Function
FUNCTION: DateAdd( )
Implemented in version 2.0
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
N
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
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information