TA的每日心情 | 开心 2021-12-13 21:45 |
---|
签到天数: 15 天 [LV.4]偶尔看看III
|
/*求两个日期之间的月数*/
select months_between(to_date('2012-3-2','YYYY-MM-DD'),to_date('2011-12-26','YYYY-MM-DD')) from dual
/*在当前日期上相加6个月*/
select ADD_MONTHS(trunc(sysdate,'DD'),6) from dual;
/*求下个星期一的日期*/
select NEXT_DAY(sysdate,'星期一') "Next Day" from dual
/*求一个月中的最后一天*/
select LAST_DAY(sysdate) "Last Day" from dual;
/*对日期进行四舍五入*/
select round(sysdate,'YEAR') from dual;
select round(sysdate,'MONTH') from dual; |
|