Home : Products : Job Cal Plus : Documentation : Custom Reports : VBScript Functions : DateAdd vbscript Function
Q13848 - INFO: DateAdd vbscript Function

DateAdd(interval,number, date) is a custom report vbscript function that returns a date to which a specified time interval has been added.

Arguments

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.

Settings
The intervall 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

You can use the DateAdd function to add or subtract a specified time interval from a date. For example, you can use DateAdd to calculate a date 30 days from today or a time 45 minutes from now. To add days to date, you can use Day of Year ("y"), Day ("d"), or Weekday ("w").

The DateAdd function won't return an invalid date. The following example adds one month to January 31:

NewDate = DateAdd("m", 1, "31-Jan-95")

In this case, DateAdd returns 28-Feb-95, not 31-Feb-95. If date is 31-Jan-96, it returns 29-Feb-96 because 1996 is a leap year.

If the calculated date would precede the year 100, an error occurs.

If number isn't a Long value, it is rounded to the nearest whole number before being evaluated.

 

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 3/1/2012 11:58 AM.
Last Modified on 3/1/2012 11:58 AM.
Last Modified by No Author Name Available!.
Article has been viewed 3527 times.
Rated 0 out of 10 based on 0 votes.
Print Article
Email Article