1, Function: Add_months (Date,integer)--Add the specified time to a few months
For example:
SELECT add_months (sysdate, 1) from DUAL; -The current time plus 1 months, that is, one months after the time. SELECT add_months (Sysdate,-1) from DUAL; --The current time minus 1 months, that is, one months ago.
2, add and subtract a time for the sysdate.
For example:
SELECT sysdate + 1 from DUAL; -The current time plus 1 days, that is, a day after the time (here the 1 units are days). SELECT SYSDATE-1 from DUAL; --The current time is reduced by 1 days, that is, one day before. SELECT sysdate + 1/24 from DUAL; -The current time is 1 hours, or one hour later. SELECT sysdate + 1/24/60 from DUAL; --The current time is 1 minutes, that is, one minute after the time. SELECT sysdate + 1/24/60/60 from DUAL; --The current time is 1 seconds, which is the time after one second.
Similarly, if it is minus (-), it is a set time to push forward.
3,interval
The usage of interval is:
SELECT sysdate +/-INTERVAL ' N ' timeunit from DUAL;
Description
N: Numbers, that is, how much time to add and subtract, be sure to have single quotes.
Timeunit is: Time unit, desirable value is Year,month,day,hour,minute,second
For example:
SELECT sysdate + INTERVAL ' 1 ' days from dual;--current time plus 1 months, i.e. one months later. SELECT sysdate-interval ' 1 ' HOUR from dual;--current time minus 1 hours, or one hours ago.
This article is from the "Evan" blog, be sure to keep this source http://wenshengzhu.blog.51cto.com/5151285/1708530
Oracle time Plus and minus