计算距离'2011-05-01'到2012-05-14的年月日

 

计算距离'2011-05-01'到2012-05-14的日期.

SQL> select to_char(sysdate,'yyyy')-to_char(to_date('2011-05-01','yyyy-MM-dd'),'yyyy') year,floor(months_between(sysdate,to_date('2011-05-01','yyyy-MM-dd')))month,round(sysdate-to_date('2011-05-14','yyyy-MM-dd'))day from dual;



      YEAR      MONTH        DAY
---------- ---------- ----------
         1         12        367

 

你可能感兴趣的:(2012)