1. conversion functions
The biggest relationship with the date operation is the two conversion functions: to_date (), to_char ()
To_date () converts the character type to the date type in a certain format:
Specific usage: to_date ('1970-11-27 ', 'yyyy-mm-dd'). The former is a string, and the latter is a conversion date format. Note that the first and second data must be in the correct format.
For example, to_date ('2017-11-27 13:34:43 ', 'yyyy-mm-dd hh24: MI: ss') will get the specific time
Multiple date formats:
Yyyy: Year in four bits
YYY, YY, Y: the last three digits, two digits, or one digit of the year. The default value is the current century.
MM: 01 ~ 12 month number
Month: The month, which contains nine characters. Fill the month with spaces on the right.
Mon: the abbreviation of A Three-character month
WW: week of the year
D: The day of the week
DD: The day of the month.
DDD: The day of the year
Day: The full name of the day, expressed in nine characters, and filled with spaces on the right
HH, hh12: the hour of the day, 12 hexadecimal notation
Hh24: The hour in a day. The value ranges from 00 ~ 23
Mi: minute in an hour
SS: seconds in one minute
Ssss: the number of seconds since midnight
To_char (): Convert the date to a certain format to the character type
SQL> select to_char (sysdate, 'yyyy-mm-dd hh24: MI: ss') time from dual;
Time
-------------------
2004-10-08 15:22:58
Converts the current time to the character type in yyyy-mm-dd hh24: MI: SS format.