Description:
Returns a date to which a specified time span has been added.
In the PROMOTIC system it is better to use the Pm.DateAdd method.
Syntax:
Date DateAdd(String timeSpan, Long number, Date date)
Parameters:
timeSpan | (String) Specifies type of time span:
yyyy - year
q - quarter
m - month
y - day of year
d - day
w - day of the week
ww - week of year
h - hour
n - minute
s - second |
number | (Long) The number of time-spans you want to add.
The number can be either positive number, for dates in the future, or negative number, for dates in the past. |
date | (Date) Date to which time span is added. |
---|
Note:
The function can be used to add or subtract a specified time span from a date. For example, it can be used for calculation a date 30 days from today or a time 45 minutes from now.
To add days to date, can be used day of year ("y"), day ("d") or day of the week ("w").
If the computed date is before year 100, then an error occurs.
Example:
The example adds one month to 31-Jan-2024:
VBScriptSelect and copy to clipboard
Dim NewDate
NewDate = DateAdd("m", 1, "31-Jan-2024")