日期:2014-05-16 浏览次数:20451 次
?
oracle?两个时间相减默认的是天数
oracle 两个时间相减默认的是天数*24 为相差的小时数
oracle 两个时间相减默认的是天数*24*60 为相差的分钟数
oracle 两个时间相减默认的是天数*24*60*60 为相差的秒数
测试如下:
SQL>select sysdate from dual;
?????? 2008-2-20 14:32:35
SQL> select (sysdate-to_date('2008-02-17 23:00:00','yyyy-mm-dd hh24:mi:ss')) from dual;
?
(SYSDATE-TO_DATE('2008-02-1723
------------------------------
????????????? 2.64659722222222
?
SQL> select (sysdate-to_date('2008-02-17 23:00:00','yyyy-mm-dd hh24:mi:ss'))*24 from dual;
?
(SYSDATE-TO_DATE('2008-02-1723
------------------------------
???????????????????????? 63.52
SQL> select (sysdate-to_date('2008-02-17 23:00:00','yyyy-mm-dd hh24:mi:ss'))*24*60 from dual;
?
(SYSDATE-TO_DATE('2008-02-1723
------------------------------
??????????????????????? 3811.5
?
SQL> select (sysdate-to_date('2008-02-17 23:00:00','yyyy-mm-dd hh24:mi:ss'))*24*60*60 from dual;
?
(SYSDATE-TO_DATE('2008-02-1723
------------------------------
??????????????????????? 228700
转:http://space.itpub.net/7199859/viewspace-179627#xspace-itemform
oracle日期计算:http://www.cnblogs.com/raymond19840709/archive/2009/03/26/1422037.html
oracle 两个时间月份差:
select months_between(to_date('2004-02-03','yyyy-mm-dd'),to_date('2004-05-03','yyyy-mm-dd')) from dual;
oracle 月份加减
add_months(to_date('200401','yyyymm'),-2 )
?
?