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-48
DATEFORMAT Function
DATEFORMAT Function
The DATEFORMAT function returns a datetime value as a character string literal in the
DEFAULT, USA, or EUROPEAN format. The data type of the result is CHAR.
DATEFORMAT is an SQL/MX extension.
datetime-expression
is an expression that evaluates to a datetime value of type DATE, TIME, or
TIMESTAMP. See Datetime Value Expressions on page 6-43.
DEFAULT | USA | EUROPEAN
specifies a format for a datetime value. See Datetime Literals on page 6-68.
Examples of DATEFORMAT
Convert a datetime literal in DEFAULT format to a string in USA format:
DATEFORMAT (TIMESTAMP '1996-06-20 14:20:20.00', USA)
The function returns this string literal:
'06/20/1996 02:20:20.00 PM'
Convert a datetime literal in DEFAULT format to a string in European format:
DATEFORMAT (TIMESTAMP '1996-06-20 14:20:20.00', EUROPEAN)
The function returns this string literal:
'20.06.1996 14.20.20.00'
DATE_SUB Function
The DATE_SUB function subtracts the specified interval-expression from 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.
DATEFORMAT (datetime-expression,{DEFAULT | USA | EUROPEAN})
DATE_SUB (datetime_expression, interval_expression)










