- Year, English full name of vintage
- YYYY: Year four-bit representation
- Yyy,yy,y: The last three, two, or a bit of the year, the default is the current century
- Month Number of mm:01~12
- Month: Nine characters in months, and the right is filled with a space
- MON: three-character month abbreviation
- W: The week ordinal of the month
- WW: The first week of the year
- D: The day of the week
- DD: The day ordinal of the month
- DDD: The first day of the year
- Day: When in a few days to write, the right with a space to complete
- DY: When in a few days abbreviation
- Q: Quarterly
- Hh,hh12: The first hour of the day, 12 binary notation
- HH24: The first hour of the day, the value is 00~23
- MI: Minutes in an hour
- SS: seconds in one minute
- SSSS: The number of seconds to go from midnight
Example: 1, ask the day of the week: Select To_char (to_date (' 2002-08-26 ', ' YYYY-MM-DD ') from dual; return Monday. Select To_char (to_date (' 2002-08-26 ', ' yyyy-mm-dd '), ' Day ', ' nls_date_language = American ') from dual; return to Monday. 2, set the date language: ALTER SESSION set nls_date_language= ' AMERICAN '; 3, the number of days to find two days: Select Floor (sysdate-to_date (' 20020405 ', ' YYYYMMDD ')) from dual; return 4080.
ORACLE to_char,to_date Function Format description