Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











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-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information