web 2.0

ASP/VBScript DateAdd()

ASP/VBScript DateAdd() Returns a date to which a specified time interval has been added.

ShotDev Focus:
- Using Asp and DateAdd() function.


DateAdd(interval, number, date)

The DateAdd function syntax has these parts:

Part Description
interval Required. String expression that is the interval you want to add. See Settings section for values.
number Required. Numeric expression that is the number of interval you want to add. The numeric expression can either be positive, for dates in the future, or negative, for dates in the past.
date Required. Variant or literal representing the date to which interval is added.

The interval argument can have the following values:

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



<% Option Explicit %>
<title>ShotDev.Com Tutorial</title>
Response.write Date()&"<br>"
Response.write DateAdd("d",10,"09/01/2010")&"<br>"
Response.write DateAdd("m",3,"09/01/2010")&"<br>"
Response.write DateAdd("n",60,"12:00")&"<br>"
Response.write DateAdd("h",3,"15:30")&"<br>"

Create a asp file and save to path root-path/myasp/



ASP/VBScript & DateAdd()

Download this script.

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.