标签:
1 SQL> select sysdate ,sysdate+2 from dual; 2 3 SYSDATE SYSDATE+2 4 ----------- ----------- 5 2014-12-23 2014-12-25 6 7 SQL> select hiredate,sysdate-hiredate from emp; 8 9 HIREDATE SYSDATE-HIREDATE 10 ----------- ---------------- 11 1980-12-17 12424.8094328704 12 1981-2-20 12359.8094328704 13 1981-2-22 12357.8094328704 14 1981-4-2 12318.8094328704 15 1981-9-28 12139.8094328704 16 1981-5-1 12289.8094328704 17 1981-6-9 12250.8094328704 18 1981-11-17 12089.8094328704 19 1981-9-8 12159.8094328704 20 1981-12-3 12073.8094328704 21 1981-12-3 12073.8094328704 22 1982-1-23 12022.8094328704 23 24 13 rows selected 25
MONTHS_BETWEEN-----两个日期相差的月数
ADD_MONTHS ------向指定日期中加上若干月数
NEXT_DAY ------指定日期的下一个日期
LAST_DAY -----本月的最后一天
ROUND -----日期四舍五入
TRUNC -----日期截断
1 SQL> select sysdate,add_months(sysdate,2) from dual; 2 3 SYSDATE ADD_MONTHS(SYSDATE,2) 4 ----------- --------------------- 5 2014-12-23 2015-2-23 下午 07:30:25 6 7 SQL> select sysdate,add_months(sysdate,2) from dual; 8 9 SYSDATE ADD_MONTHS(SYSDATE,2) 10 ----------- --------------------- 11 2014-12-23 2015-2-23 下午 07:30:25 12 13 SQL> select sysdate,next_day(sysdate,‘星期一‘) from dual; 14 15 SYSDATE NEXT_DAY(SYSDATE,‘星期一‘) 16 ----------- -------------------------- 17 2014-12-23 2014-12-29 下午 07:31:34 18 19 SQL> select sysdate, last_day(sysdate) from dual; 20 21 SYSDATE LAST_DAY(SYSDATE) 22 ----------- ----------------- 23 2014-12-23 2014-12-31 下午 07: 24 25 26 SQL> select round(sysdate,‘month‘),trunc(sysdate,‘month‘) from dual; 27 28 ROUND(SYSDATE,‘MONTH‘) TRUNC(SYSDATE,‘MONTH‘) 29 ---------------------- ---------------------- 30 2015-1-1 2014-12-1
标签:
原文地址:http://www.cnblogs.com/liuwt365/p/4180813.html