Oracle Date Conversion
Conversion functions
The biggest relationship with date operations is two conversion functions: To_date (), To_char ()
The to_date () action converts a character type to a date type in a certain format:
Specific usage: to_date (' 2004-11-27 ', ' yyyy-mm-dd '), the former is a string, the latter is the conversion date format, note that the two should be a corresponding.
such as; To_date (' 2004-11-27 13:34:43 ', ' yyyy-mm-dd hh24:mi:ss ') will be given a specific time of multiple date formats:
YYYY: four-bit year
Yyy,yy,y: Last three-bit, two-bit, or one-digit of year, defaults to current century
Month Number of mm:01~12
MONTH: Month of nine characters, padding on right with space
MON: Month abbreviation for three-bit characters
WW: Week of the Year
D: Day of the week
DD: Day of the month
DDD: The first day of the year
Day: The full name of the days of nine characters, padded with spaces on the right
Hh,hh12: The first few hours of the day, the 12 notation
HH24: The first few hours of the day, with a value of 00~23
MI: minutes in one hour
SS: seconds in one minute
SSSS: The number of seconds since midnight
To_char (): Convert date to character type in a certain format
Sql> Select To_char (sysdate, ' yyyy-mm-dd hh24:mi:ss ') time from dual;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.