Neoview SQL Reference Manual (R2.2)
DATE_ADD Function
The DATE_ADD function adds the interval specified by interval_expression to
datetime_expr. If the specified interval is in years or months, DATE_ADD normalizes the
result. See “Standard Normalization” (page 279). The type of the datetime_expr is returned,
unless the interval_expression contains any time components, then a timestamp is returned.
DATE_ADD is a Neoview extension.
DATE_ADD (datetime_expr, interval_expression)
datetime_expr
is an expression that evaluates to a datetime value of type DATE or TIMESTAMP. See
“Character Value Expressions” (page 208).
interval_expression
is an expression that can be combined in specific ways with addition operators. The
interval_expression accepts all interval expression types that the Neoview database
software considers as valid interval expressions. See “Interval Value Expressions” (page 213).
Examples of DATE_ADD
• This function returns the value DATE '2001-03-07'
DATE_ADD(DATE '2001-02-28', INTERVAL '7' DAY)
• This function returns the value DATE '2000-03-06'
DATE_ADD(DATE '2000-02-28', INTERVAL '7' DAY)
• This function returns the timestamp '2005-03-07 00:00:00'
DATE_ADD(timestamp'2004-02-29 00:00:00', INTERVAL '7' DAY)
• This function returns the timestamp '2004-02-28 23:59:59'
DATE_ADD(timestamp '2003-02-28 23:59:59', INTERVAL '12' MONTH)
Note: compare the last example with the last example under DATE_SUB.
318 SQL Functions and Expressions