利用To_Char()函数从Oracle时间中分别提取年月日时分秒

转自: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

©️2020 CSDN 皮肤主题: 技术黑板 设计师:CSDN官方博客 返回首页