Add a time interval to a Date
Syntax DateAdd (interval,number,date) Key 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.
Example: add 7 days
dtmStart="18-Feb-10" WScript.Echo "Start Date" & dtmStart dtmFinish=DateAdd("d",7,dtmStart) WScript.Echo "End Date" & dtmFinish
“We waste time looking for the perfect lover, instead of creating the perfect love” ~ Tom Robbins
Related:
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 in Powershell - Date.AddDays(-7)