Add a time interval to a Date

      DateAdd (interval,number,date)

   number    The number of intervals to add

   date      The date

   interval  The date/Time interval to add:

                yyyy  Year
                 q    Quarter
                 m    Month
                 y    Day of year
                 d    Day
                 w    Weekday
                 h    Hour
                 n    Minute
                 s    Second

To subtract dates just specify number as a negative, i.e. "m", -6 will subtract 6 months.


Add 7 days:

WScript.Echo "Start Date" & dtmStart
WScript.Echo "End Date" & dtmFinish

“We waste time looking for the perfect lover, instead of creating the perfect love” ~ Tom Robbins

Related VBScript commands

Date - The current system date.
DateDiff - Return the time interval between two dates.
DatePart - Return a unit of time from a date.
DateSerial - Return a Date from a numeric Year, Month and Day.
Weekday - Return the day of the week.
Q218964 - VBScript Date and Time formats change with logged on user.
Equivalent PowerShell: Date.AddDays(-7)

Copyright © 1999-2024
Some rights reserved