There are many date conversion functions in Oracle, and the common commands are as follows:
SELECT to_char (sysdate, ' Yyyy-mm-dd hh24:mi:ss ') from DUAL;
Syntax: To_char (X [, format])
Description: Converts x into a string by format. X can be a date or a number or a timestamp, format is a formatted string that specifies what format to convert x
SELECT to_date (' 2014-05-07 13:23:44 ', ' yyyy-mm-dd hh24:mi:ss ') from DUAL;
Syntax: To_date (C [, format])
Description: Converts a string C that conforms to a specific date format specified by format to a date type of data
SELECT to_timestamp (' 2014-06-20 12:11:11 ', ' yyyy-mm-dd HH24:MI:SS ') from dual;
Syntax: To_timestamp (C [, format])
Description: Converts a string C to a timestamp data type
The---to_char () command converts a timestamp to a string:
Select To_char (To_timestamp (' 2014-06-20 12:11:11 ', ' yyyy-mm-dd HH24:MI:SS '), ' Yyyy-mm-dd HH24:MI:SS ') from dual;
Sql> Select To_char (trunc (sysdate), ' Yyyy-mm-dd HH24:MI:SS ') from dual;
Sql> Select To_char (sysdate, ' Yyyy-mm-dd HH24:MI:SS ') from dual;
Date Conversion in Oracle