Date_Sub Function; Examples Of Date_Sub - 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 '2009-02-28'
DATE_SUB(DATE '2009-03-07', INTERVAL'7' DAY)
This function returns the value DATE '2008-02-29'
DATE_SUB(DATE '2008-03-07', INTERVAL'7' DAY)
This function returns the timestamp '2008-02-29 00:00:00'
DATE_SUB(timestamp '2008-03-31 00:00:00', INTERVAL '31' DAY)
This function returns the timestamp '2007-02-28 23:59:59'
DATE_SUB(timestamp '2008-02-29 23:59:59', INTERVAL '12' MONTH)
380
SQL Functions and Expressions
337). The type of the datetime_expr is returned, unless the
257).
"Interval Value Expressions" (page
"Standard
261).

Advertisement

Table of Contents
loading

Table of Contents