DIAdem Help

Method: DateAdd for VBS

  • Updated2024-09-12
  • 1 minute(s) read

Method: DateAdd for VBS

Adds a timespan to a date.

vDateAdd = Object.DateAdd(interval, number, Date)
ObjectVBS
Object with this method. You do not need to specify this object.
intervalVariant
Specifies the timespan to be added. The following settings are possible.
"yyyy"Year
"q" Quarter
"m" Month
"y" Day of the year
"d" Day
"w" Weekday
"ww" Week of the year
"h" Hour
"n" Minute
"s" Second
numberVariant
Specifies the number of timespans.
DateVariant
Specifies the date to which the DateAdd method adds the timespan.
vDateAddVariant
Receives the new date.

The following example adds various timespans to the current date:

Dim MyDate
MyDate = DateAdd("m", 1, Date)
Call MsgBox("Next month: " & MyDate)
MyDate = DateAdd("yyyy", 1, Date)
Call MsgBox("Next year: " & MyDate)