Neoview SQL Reference Manual (R2.3)

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 a Neoview SQL extension.
DATEFORMAT (datetime-expression,{DEFAULT | USA | EUROPEAN})
datetime-expression
is an expression that evaluates to a datetime value of type DATE, TIME, or TIMESTAMP.
See “Datetime Value Expressions” (page 220).
DEFAULT | USA | EUROPEAN
specifies a format for a datetime value. See “Datetime Literals” (page 235).
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_PART Function (of an interval)
The DATE_PART function extracts the datetime field specified by text from the interval
value specified by interval and returns the result as an exact numeric value. The DATE_PART
function accepts the specification of 'YEAR', 'MONTH', 'DAY', 'HOUR', 'MINUTE', or 'SECOND'
for text.
DATE_PART is a Neoview extension.
DATE_PART (text, interval)
text
specifies YEAR, MONTH, DAY, HOUR, MINUTE, or SECOND. The value must be enclosed
in single quotes.
interval
interval accepts all interval expression types that the Neoview database software considers
as valid interval expressions. See “Interval Value Expressions” (page 223).
The DATE_PART(text, interval) is equivalent to EXTRACT(text, interval), except that
the DATE_PART function requires single quotes around the text specification, where EXTRACT
does not allow single quotes.
When SECOND is specified the fractional part of the second is returned.
Examples of DATE_PART
This function returns the value of 7.
DATE_PART('DAY', INTERVAL '07:04' DAY TO HOUR)
This function returns the value of 6.
DATE_PART('MONTH', INTERVAL '6' MONTH)
This function returns the value of 36.33.
DATE_PART('SECOND', INTERVAL '5:2:15:36.33' DAY TO SECOND(2))
DATEFORMAT Function 333