In Oracle, TO_DATE TO_CHAR format TO_CHAR converts a date or number to a string TO_DATE format to convert a string to a database. The date type conversion function TO_NUMBER converts a character to a number. TO_CHAR uses the TO_CHAR function to process the number TO_CHAR. (number, 'format') TO_CHAR (salary, '$99,999.99'); Use the TO_CHAR function to process the date TO_CHAR (date, 'format '); www.2cto.com convert TO_NUMBER use the TO_NUMBER function to convert the character to the number TO_NUMBER (char [, 'format']) convert TO_DATE use the TO_DATE function to convert the character to the date TO_DATE (char [, 'format']) numeric format 9 represents a number 0 force display 0 $ place a $ character L place a floating local currency character. displays the decimal point and the thousands indicator www .2cto.com Date Format control description YYYY, YYY, YY represents four digits, three digits, two digits, YEAR spelling MM digit MONTH full spell mon month abbreviation DD number DAY the abbreviation of the full spell DY week AM represents the morning or afternoon HH24, HH12 12 hour, or 24 hour the MI minute SS second SP number spelling TH number the ordinal number of the word "special character "if special character HH24: MI: ss am 15:43:20 PM www.2cto.com date example: SELECT TO_DATE ('2017-05-01 19:25:34 ', 'yyyy-MM-DD HH24: MI: ss ') from dualselect TO_DATE ('2017-05-01 ', 'yyyy-MM-DD HH24: MI') from dualselect TO_DATE ('2017-0 5-01 19', 'yyyy-MM-DD hh24') from dualselect TO_DATE ('2017-05-01 ', 'yyyy-MM-DD') from dualselect TO_DATE ('2017-05 ', 'yyyy-mm') from dualselect TO_DATE ('201312', 'yyyy') from dual date Description: when the input parameters corresponding to HH, MI, and SS are omitted, oracle uses 0 as the DEFAULT value. If the input date data ignores the time part, Oracle sets the hour, minute, and second part to 0, that is, it will take the whole day. Similarly, if the DD parameter is ignored, Oracle uses 1 as the default value of the day, that is, it takes the entire month. However, do not be confused by this kind of "inertia". If the MM parameter is ignored, Oracle will not take the entire year and the entire month. Www.2cto.com Note: 1. when Oracle's to_date function is used for date conversion, the format of "yyyy-MM-dd HH: mm: ss" may be intuitively used for conversion, however, an error occurs in Oracle: "ORA 01810 format code appears twice ". For example, select to_date ('1970-01-01 13:14:20 ', 'yyyy-MM-dd HH24: mm: ss') from dual, because SQL statements are case insensitive, MM and mm are considered to be the same format code, so Oracle SQL uses mi instead of minutes. Select to_date ('1970-01-01 13:14:20 ', 'yyyy-MM-dd HH24: mi: ss') from dual; 2. in addition, it should be displayed in 24 hours to use HH24select to_char (sysdate, 'yyyy-MM-dd HH24: mi: ss') from dual; // mi is minute select to_char (sysdate, 'yyyy-MM-dd HH24: mm: ss') from dual; // mm displays the month