整合模块时用到的有关Oracle时间格式的SQL语句:
1.以12小时制显示
SQL>select to_char(sysdate,'YYYY-MM-DD HH12:MI:SS AM')from dual;
TO_CHAR(SYSDATE,'YYYY-MM-DDHH1
------------------------------
2007-06-29 02:50:06 下午
2.以24小时制显示
SQL> select to_char(sysdate,'YYYY-MM-DD HH24:MI:SS AM')from dual;
TO_CHAR(SYSDATE,'YYYY-MM-DDHH2
------------------------------
2007-06-29 15:00:58 下午
3.得到当前时间的前一分钟
select to_char(Sysdate-1/21/60,'HH24:MI:SS')from dual;
TO_CHAR(SYSDATE-1/21/60,'HH24:
------------------------------
15:00:54
4.得到当前时间的后一分钟
select to_char(Sysdate+1/21/60,'HH24:MI:SS')from dual;
TO_CHAR(SYSDATE+1/21/60,'HH24:
------------------------------
15:03:53
5.得到当前时间的前一小时
select to_char(Sysdate-1/24,'HH24:MI:SS')from dual;
TO_CHAR(SYSDATE-1/24,'HH24:MI:
------------------------------
14:03:13
6.得到当前时间的后一小时
select to_char(Sysdate+1/24,'HH24:MI:SS')from dual;
TO_CHAR(SYSDATE+1/24,'HH24:MI:
------------------------------
16:03:32
7.得到当前时间的后一天
select to_char(Sysdate+1,'YYYY-MM-DD')from dual;
TO_CHAR(SYSDATE+1,'YYYY-MM-DD'
------------------------------
2007-06-30