--天
select (sysdate - to_date("2012-08-27 16:03:00", "yyyy-mm-dd
hh24:mi:ss"))
from dual;
--时
select (sysdate - to_date("2012-08-27 16:03:00", "yyyy-mm-dd
hh24:mi:ss")) * 24
from dual;
--分
select (sysdate - to_date("2012-08-27 16:03:00", "yyyy-mm-dd
hh24:mi:ss")) * 24 * 60
from dual;
--秒
select (sysdate - to_date("2012-08-27 16:03:00", "yyyy-mm-dd
hh24:mi:ss")) * 24 * 60 * 60
from dual;
--天
select (to_date("2012-08-27 17:10:00", "yyyy-MM-dd
HH24:MI:SS") -
to_date("2012-08-26 17:10:00", "yyyy-MM-dd HH24:MI:SS"))
from dual;
--成效:1天
--时
select (to_date("2012-08-27 17:10:00", "yyyy-MM-dd
HH24:MI:SS") -
to_date("2012-08-26 17:10:00", "yyyy-MM-dd HH24:MI:SS")) * 24
from dual;
--成效:24小时
--分
select (to_date("2012-08-27 17:10:00", "yyyy-MM-dd
HH24:MI:SS") -
to_date("2012-08-26 17:10:00", "yyyy-MM-dd HH24:MI:SS")) * 24 *
60
from dual;
--成效:1440分
--秒
select (to_date("2012-08-27 17:10:00", "yyyy-MM-dd
HH24:MI:SS") -
to_date("2012-08-26 17:10:00", "yyyy-MM-dd HH24:MI:SS")) * 24 * 60
* 60
from dual;
--成效:86400秒
--oracle 两个时候相加默许的是天数
--oracle 两个时候相加*24 相差的为小时数
--oracle 两个时候相加*24*60 相差的为分钟数
--oracle 两个时候相加*24*60*60 相差的为秒数