Date_Sub Function; Examples Of Date_Sub; Dateadd Function - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

DATE_SUB Function

The DATE_SUB function subtracts the specified interval_expression from datetime_expr.
If the specified interval is in years or months, DATE_SUB normalizes the result. See
Normalization" (page
interval_expression contains any time components, then a timestamp is returned.
DATE_SUB is a Neoview extension.
DATE_SUB (datetime_expr, interval_expression)
datetime_expr
is an expression that evaluates to a datetime value of type DATE or TIMESTAMP. See
"Datetime Value Expressions" (page
interval_expression
is an expression that can be combined in specific ways with subtraction operators. The
interval_expression accepts all interval expression types that the Neoview database
software considers as valid interval expressions. See

Examples of DATE_SUB

This function returns the value DATE '2001-02-28'
DATE_SUB(DATE '2001-03-07', INTERVAL'7' DAY)
This function returns the value DATE '2000-02-29'
DATE_SUB(DATE '2000-03-07', INTERVAL'7' DAY)
This function returns the timestamp '2004-02-29 00:00:00'
DATE_SUB(timestamp '2004-03-31 00:00:00', INTERVAL '31' DAY)
This function returns the timestamp '2003-02-28 23:59:59'
DATE_SUB(timestamp '2004-02-29 23:59:59', INTERVAL '12' MONTH)

DATEADD Function

The DATEADD function adds the interval of time specified by datepart and num_expr to
datetime_expr. If the specified interval is in years or months, DATEADD normalizes the
result. See
"Standard Normalization" (page
unless the interval_expression contains any time components, then a timestamp is returned.
DATEADD is a Neoview extension.
DATEADD(datepart, num_expr, datetime_expr)
datepart
is YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, QUARTER, WEEK, or one of the
following abbreviations:
YY and YYYY
M and MM
D and DD
HH
MI and M
SS and S
Q and QQ
WW and WK
279). The type of the datetime_expr is returned, unless the
210).
279). The type of of the datetime_expr is returned,
"Interval Value Expressions" (page
DATE_SUB Function
"Standard
213).
319

Advertisement

Table of Contents
loading

Table of Contents