oracle关于时间的处理,如计算间隔天数

一、

select sysdate from dual;
SELECT APPLY_DATE ,round((select sysdate from dual)-APPLY_DATE,0) from DT_AUDIT_UPDATE ;
SELECT APPLY_DATE ,round((select sysdate from dual)-APPLY_DATE,0) len ,a.* from DT_AUDIT_UPDATE a
where a.STATUS ='1' and round((select sysdate from dual)-APPLY_DATE,0)>60;

注:https://www.cnblogs.com/AnneHan/p/4708386.html

       https://www.cnblogs.com/powerwu/articles/5579406.html

二、

select trunc(时间1- 时间2) from table_name;

时间1和时间2必须是date类型 如果不是必须to_date;

注:https://blog.csdn.net/gahaya/article/details/8148337

三、

格式化日期:     TO_CHAR(SYSDATE(),'YY/MM/DD HH24:MI:SS)

eg:

select TO_CHAR(a.last_login_time,'YY/MM/DD HH24:MI:SS') ,a.*  from JC_USER a where a.USERNAME ='admin'

 

你可能感兴趣的:(orcale)