TO_CHAR(DateTime)
Purpose
Converts a date_timestamp_value to a character string.
Syntax
where:
Syntax element … |
Specifies … |
TD_SYSFNLIB |
the name of the database where the function is located. |
date_timestamp_value |
a datetime or interval argument. |
format_arg |
an optional character argument. For valid format_arg values, see “TO_DATE” on page 801. format_arg formats the date, time stamp, or interval value. If format_arg is omitted, a default format is used. If format_arg is not valid, an error is returned. |
ANSI Compliance
This is a Teradata extension to the ANSI SQL:2011 standard.
Invocation
TO_CHAR(DateTime) is an embedded services system function. For information on activating and invoking embedded services functions, see “Embedded Services System Functions” on page 24.
Argument Types and Rules
Expressions passed to this function must have the following data types:
Result Type
TO_CHAR(DateTime) is a scalar function whose return data type is VARCHAR CHARACTER SET UNICODE.
Example
The following query:
SELECT TO_CHAR(DATE '2003-12-23', 'DD-MON-YYYY');
returns a result of '23-DEC-2003'.