oracle截取时间的年/月/日/时/分/秒
修改日期格式为年月日时分秒: alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') as nowTime from dual; //日期转化为年月日时分秒格式
select to_char(sysdate,'yyyy') nowYear from dual; //获取时间的年
select to_char(sysdate,'mm') nowMonth from dual; //获取时间的月
select to_char(sysdate,'dd') nowDay from dual; //获取时间的日
select to_char(sysdate,'hh24') nowHour from dual; //获取时间的时
select to_char(sysdate,'mi') nowMinute from dual; //获取时间的分
select to_char(sysdate,'ss') nowSecond from dual; //获取时间的秒
时光如水,总是无言。若你安好,便是晴天。
本文来自博客园,作者:OceanWaves,转载请注明原文链接:https://www.cnblogs.com/OceanWaves/p/12007000.html

浙公网安备 33010602011771号