Select year, month, day, and quarter for the ORACLE time field -- get year, month, and quarter select to_char (date, 'yyyymmdd') DATE_ID, to_char (date, 'yyyy ') | 'Year' | to_char (date, 'mm') | 'month' | to_char (date, 'dd') | 'day' DATE_NAME, to_char (date, 'yyyymm') MONTH_ID, to_char (date, 'yyyy') | 'Year' | to_char (date, 'mm') | 'month' MONTH_NAME, 'q' | to_char (date, 'q. yyyy ') QUARTERID, to_char (date, 'yyyy') | 'Year' | to_char (date, 'q') | 'quarter 'quarterid_name, to_char (date, 'yyyy') YEAR_ID, to_char (date, 'yyyy') | 'Year' YEAR_NAME from (select to_date ('2017-01-01 ', 'yyyy-mm-dd ') + (rownum-1) date from user_objects where rownum <367 and to_date ('2017-01-01 ', 'yyyy-mm-dd') + (rownum-1) <to_date ('1970-01-01 ', 'yyyy-mm-dd'); -- Obtain the ing between the quarter and the month. select distinct to_char (date, 'q') quarter, to_char (to_date ('1970-01-01 ', 'yyyy-mm-dd') + (rownum-1), 'yyymmm') date from (select to_date ('1970-01 ', 'yyyy-mm') + (rownum-1) date from user_objects where rownum <367 and to_date ('2017-01-01 ', 'yyyy-mm-dd') + (rownum-1) <to_date ('1970-01-01 ', 'yyyy-mm-dd'); -- select to_char (to_date ('1970-01-01 ', 'yyyy-mm-dd') + (rownum-1), 'yyyy-mm-dd') date from user_objects where rownum <367 and to_date ('2017-01-01 ', 'yyyy-mm-dd') + (rownum-1) <to_date ('2017-01-01 ', 'yyyy-mm-dd'); summary: to_char (sysdate, 'q ') season to_char (sysdate, 'yyyy') year to_char (sysdate, 'mm') month to_char (sysdate, 'dd') day to_char (sysdate, 'D ') DAY of the week to_char (sysdate, 'day') DAY of the week to_char (sysdate, 'ddd ') other method in the year: select extract (month from query_cxrq) from app_queryextract (year from query_cxrq) year extract (month from query_cxrq) month extract (day from query_cxrq) day -- convert the date format variable with time to the date format string method: 1. datetime. tostring ("yyyy. MM. dd ") 2. formatdatetime (datetime," yyyy. MM. dd ") 3. convert. todatetime (str ). tow.datestring ()