To_date () is the Oracle date conversion function. You can convert the character type to the date type in a certain format. Let's take a look at the syntax of the Oracle date conversion function.
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:
Usage: to_date ('1970-11-27 '', ''yyyy-mm-dd''). The former is a string, and the latter is a conversion date format. Note, the two must be one-to-one.
For example, to_date ('2017-11-27 13:34:43 '', ''yyyy-mm-dd hh24: mi: s'') 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: s'') time from dual;
The preceding section describes the syntax of Oracle date conversion functions.
Oracle Pipeline Function usage
Use of oracle custom functions
Oracle date functions
Introduction to Oracle System Variable Functions
Syntax for creating an Oracle package