Converts a value of TIMESTAMP
data type to a value of VARCHAR2
data type in a specified format. If you do not specify a format, then the function converts values to the default timestamp format.
Syntax
See the syntax of the TO_CHAR
function in Oracle Database SQL Language Reference.
Restrictions
The following restrictions apply when you use the TIMESTAMP_TO_CHAR
function in the SELECT
command:
The function converts only TIMESTAMP
data type. TIMESTAMP
WITH
TIME
ZONE
, TIMESTAMP
WITH
LOCAL
TIME
ZONE
, and other data types are not supported.
The function does not support the nlsparm
argument. The function uses the default language for your session.
Example
This example converts the create_time for each incident from a TIMESTAMP
data type to a VARCHAR2
data type in the DD-MON-YYYY
format.
select timestamp_to_char(create_time, 'DD-MON-YYYY') from incident;