Promotic
WikipediaLinkedInYoutubeTwitterFacebook

DateAdd - function of language VBScript

Description:
Returns a date to which a specified time interval has been added.
Syntax:
DateAdd(interval As Variant, number As Variant, date As Variant) As Date
Calling:
d = DateAdd(interval, number, date)
Parameters:
interval(Variant) String expression that is the interval you want to add:
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(Variant) 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(Variant) Variant or literal representing the date to which interval is added.
Note:

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 day of the week ("w").

If the computed date is before year 100, then it generates an error.

Example:
The Example adds one month to January 31 2019:
Dim NewDate
NewDate = DateAdd ("m", 1, "31-Jan-2019")
In this case, function returns 28-Feb-2019, not 31-Feb-2019. If date is 31-Jan-2020, it returns 29-Feb-2020 because 2020 is a leap year.
PROMOTIC 8.3.21 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice