SQL/MX 3.2 Reference Manual (H06.25+, J06.14+)

SQL/MX Functions and Expressions
HP NonStop SQL/MX Release 3.2 Reference Manual691117-001
9-44
DATE_ADD Function
DATE_ADD Function
The DATE_ADD function adds the interval specified by the interval_expression
to the datetime_expression.
datetime_expression
is an expression that specifies a datetime value of type, DATE, TIMESTAMP, or
TIME.
interval_expression
is an expression that specifies an INTERVAL data type.
Return type
The return type is same as the type of datetime_expression, but if the
interval_expression consists of any time components, a timestamp is returned.
For example:
DATE_ADD(DATE ‘2007-02-28’, INTERVAL ‘7’ DAY) returns DATE
DATE_ADD(DATE ‘2007-02-28’, INTERVAL ‘7’ HOUR) returns TIMESTAMP
Examples of DATE_ADD
The following example illustrates the use of DATE_ADD function:
>>select dt_ts, date_add(dt_ts, interval '1' day) from T01
where sm_int = 2;
DT_TS (EXPR)
-------------------------- --------------------------
2010-02-28 20:13:53.000000 2010-03-01 20:13:53.000000
--- 1 row(s) selected.
DATEADD Function
The DATEADD function adds the num_expression units specified by the datepart
to the datetime_expression.
DATE_ADD (datetime_expression, interval_expression)