Oracle® OLAP Expression Syntax Reference Release 11.2 E23381-01 |
|
|
PDF · Mobi · ePub |
TO_CHAR(datetime)
converts a datetime or interval expression to a text string in a specified format.
VARCHAR2
TO_CHAR({ datetime | interval } [, fmt [, 'nlsparam' ] ])
datetime
is a datetime expression to be converted to text.
interval
is an interval expression to be converted to text.
fmt
is a datetime model format specifying the format of char
. The default date format is determined implicitly by the NLS_TERRITORY
initialization parameter or can be set explicitly by the NLS_DATE_FORMAT
parameter. For data type formats, refer to the Oracle Database SQL Language Reference.
nlsparam
specifies the language in which month and day names and abbreviations are returned. This argument can have this form:
'NLS_DATE_LANGUAGE = language'
By default, the return value is in the session date language.
TO_CHAR(SYSDATE)
returns a value such as 11-APR-08
.
TO_CHAR(SYSDATE, 'Day: MONTH DD, YYYY')
returns a value such as Friday : APRIL 11, 2008
.
TO_CHAR(SYSDATE, 'Day: MONTH DD, YYYY', 'NLS_DATE_LANGUAGE = Spanish')
returns a value such as Viernes : ABRIL 11, 2008
.