Name
DateAdd Function — Microsoft.VisualBasic.DateAndTime
Synopsis
DateAdd(interval,number,datevalue)
intervalrequired; String orDateIntervalenumThe interval of time to add
numberrequired; DoubleAn expression denoting the number of time intervals you want to add (it can be positive or negative)
datevaluerequired; Date, or an expression capable of conversion to a dateThe starting date to which the interval is to be added
Return Value
A past or future Date that reflects the result of the addition
Description
Returns a Date representing the result of adding (or subtracting, if
number is negative) a given number of time
periods to or from a given date. For instance, you can calculate the
date 178 months before today’s date, or the date and
time 12,789 minutes from now.
interval can be one of the following
literal strings:
|
|
Year |
|
|
Quarter |
|
|
Month |
|
|
Day of year |
|
|
Day |
|
|
Weekday |
|
|
Week |
|
|
Hour |
|
|
Minute |
|
|
Second |
interval can also be a member of the
DateInterval enum:
Enum DateInterval Day DayOfYear Hour Minute Month Quarter Second Week Weekday WeekOfYear End Enum
If number is positive, the result will be
in the future; if number is negative, the
result will be in the past. (The meaning of
“future” and
“past” here is relative to
datevalue.)
The DateAdd function has a built-in calendar algorithm to prevent it from returning an invalid date. You can add 10 minutes to 31 December 1999 23:55, and DateAdd automatically recalculates all elements of the date to return a valid ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access