转自:https://blog.csdn.net/yhrch/article/details/1791418
TO_CHAR(‘2007-1-2′,’yyyy’)转换结果为”2007″,这种方法可以很方便的从时间中分别提取年月日。示例语句:select sysdate from dual
select TO_CHAR(sysdate,’yyyy’) from dual
select TO_CHAR(sysdate,’mm’) from dual
select TO_CHAR(sysdate,’dd’) from dual
select TO_CHAR(sysdate,’HH24′) from dual
select TO_CHAR(sysdate,’mi’) from dual
select TO_CHAR(sysdate,’ss’) from dual