Method: DateAdd for VBS
- Updated2024-09-12
- 1 minute(s) read
Methods > Method: DateAdd for VBS
Method: DateAdd for VBS
Adds a timespan to a date.
vDateAdd = Object.DateAdd(interval, number, Date)
| Object | VBS Object with this method. You do not need to specify this object. | ||||||||||||||||||||
| interval | Variant Specifies the timespan to be added. The following settings are possible.
| ||||||||||||||||||||
| number | Variant Specifies the number of timespans. | ||||||||||||||||||||
| Date | Variant Specifies the date to which the DateAdd method adds the timespan. | ||||||||||||||||||||
| vDateAdd | Variant 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)