SQL/MX 3.2 Reference Manual (H06.25+, J06.14+)
SQL/MX Functions and Expressions
HP NonStop SQL/MX Release 3.2 Reference Manual—691117-001
9-45
Considerations for DATEADD
datepart
specifies the units of time being added: YEAR, MONTH, DAY, HOUR, MINUTE,
SECOND, QUARTER, WEEK, or one of the following abbreviations:
num_expression
is an SQL exact numeric value expression that specifies how many datepart
units of time must be added to the datetime_expression.
datetime_expression
is an expression that specifies a datetime value of type, DATE, TIMESTAMP, or
TIME.
Considerations for DATEADD
If the specified interval is in years or months, DATEADD normalizes the result. For
example, if the end day of the resulting date is invalid, the day will be rounded off
to the last day of the resulting month.
If num_expression has a fraction, it is ignored. However, if datepart is
SECOND, then the fractional portion for num_expression is considered.
If num_expression is negative, num_expression units of datepart are
subtracted from datetime_expression.
DATEADD(datepart, num_expression, datetime_expression)
Note. Unlike DATE_ADD function, the interval is provided in terms of
datepart and num_expression instead of an interval_expression
.
YEAR YY and YYYY
MONTH M and MM
DAY D and DD
HOUR HH
MINUTE MI
SECOND S and SS
QUARTER Q and QQ
WEEK WW and WK










