NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
D-13
DATEFORMAT Function
The following are TIME literals in default, USA, and European format, respectively:
TIME "13:40:05"
TIME "1:40:05 PM"
TIME "13.40.05"
DATEFORMAT Function
DATEFORMAT is a function that formats a date-time value in DEFAULT, USA, or
EUROPEAN format. DATEFORMAT returns a value of type CHAR.
You can use DATEFORMAT wherever an arithmetic expression is allowed.
date-time-expression
is an expression that evaluates to a value of type DATETIME, DATE, TIME, or
TIMESTAMP.
{ DEFAULT }
{ USA }
{ EUROPEAN }
specifies a display format for a date-time value. See DATE-TIME Literals on
page D-9 for a description of the formats.
The default is DEFAULT.
Examples—DATEFORMAT
The following function call converts a date-time literal in DEFAULT format to USA
format:
DATEFORMAT( DATETIME "1989-06-20:10:20" YEAR TO MINUTE, USA )
It returns:
06/20/1989 10:20 AM
{ DEFAULT }
DATEFORMAT ( date-time-expression, { USA } )
{ EUROPEAN }