欢迎投稿

今日深度:

【Oracle中获取系统时间的分秒函数】,oracle分秒

【Oracle中获取系统时间的分秒函数】,oracle分秒


1.得到系统当前时间的年份

select to_char(sysdate, 'yyyy' ) from dual; --年

2.得到系统当前时间的月份
select to_char(sysdate, 'MM' ) from dual; --月

3.得到系统当前时间的日期
select to_char(sysdate, 'dd' ) from dual; --日

4.得到系统当前时间的季度

select to_char(sysdate, 'Q') from dual; --季

5.得到系统当前时间的周数(按日历上的那种,每年有52或者53周)

select to_char(sysdate, 'iw') from dual; --周--

格式化日期:

TO_CHAR(SYSDATE(),'YY/MM/DD HH24:MI:SS)

或 TO_DATE(SYSDATE(),'YY/MM/DD HH24:MI:SS)

select to_char(sysdate,'yyyy-MM-dd HH24:mi:ss') from dual;

select to_char(sysdate,'yyyy-MM-dd HH24:mm:ss') from dual;

select to_char(sysdate,'yy-mm-dd hh24:mi:ss') from dual

select to_date('2009-12-25 14:23:31','yyyy-mm-dd,hh24:mi:ss') from dual


www.htsjk.Com true http://www.htsjk.com/shujukunews/7102.html NewsArticle 【Oracle中获取系统时间的分秒函数】,oracle分秒 1.得到系统当前时间的年份 select to_char(sysdate, 'yyyy' ) from dual; --年 2.得到系统当前时间的月份 select to_char(sysdate, 'MM' ) from dual; --月 3.得到...
评论暂时关闭