Name
DateAdd Function
Syntax
DateAdd(interval,number,date)
-
interval Use: Required
Data Subtype: String
An expression denoting the interval of time you need to add or subtract (see the following table “Interval Settings”).
-
number Use: Required
Data Subtype: Numeric expression
An expression denoting the number of time intervals you want to add or subtract.
-
date Use: Required
Data Subtype: Date
A Variant of subtype Date or a literal denoting the date on which to base the
DateAddcalculation.
Interval Settings
|
Setting |
Description |
|---|---|
|
|
Year |
|
|
Quarter |
|
|
Month |
|
|
Day of year |
|
|
Day |
|
|
Weekday |
|
|
Week |
|
|
Hour |
|
|
Minute |
|
|
Second |
Return Value
A Variant of subtype Date.
Description
Returns a variant of subtype Date representing the result of adding or subtracting a given number of time periods to or from a given date or time. For instance, you can calculate the date 178 months before today’s date, or the date and time 12,789 minutes from now.
Rules at a Glance
Specify the interval value as a string enclosed in quotation marks (e.g.,
"ww").If
numberis positive, the result will be afterdate; ifnumberis negative, the result will be beforedate.The
DateAddfunction has a built-in calendar algorithm to prevent it from returning an invalid date. For example, you can add 10 minutes to 31 December 1999 23:55, andDateAddautomatically recalculates all elements of the date to return a valid date, in this case, 1 January 2000 00:05. This includes leap years: the calendar ...
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