ORACLE date plus minus function __ function

Source: Internet
Author: User

Add_months: Add Month
SELECT Sysdate,add_month (sysdate,1) from DUAL;
Sysdate add_months (sysdate,1)
-----------   ---------------------
03-1-8 16:2 03-2-8 16:21:59

Plus Day:sql> SELECT sysdate,sysdate+1 from DUAL;

Sysdate sysdate+1
-----------   -----------
03-1-8 16:2 03-1-9 16:2

-----------------------------------------------------------------------

No addition between date and date

Sql> select Sysdate+sysdate from dual;

Select Sysdate+sysdate from dual

ORA-00975: Date + date not allowed

Date and number can be added

Sql> select sysdate+1 from dual;

Sysdate+1
-----------
2003-1-9 16:52:32

Date and date can be subtracted

Sql> select Sysdate-sysdate from dual;

Sysdate-sysdate
---------------
0

--------------------------------------------------------------------------------

Add_months (d,x)
Return d date plus x month date
Last_day (D)
Returns the date of the last day of the month that contains the date D


Add_months (sysdate,1) plus one months

Add_months (sysdate,-1) minus one months

Sysdate+1 Plus One day

-------------------------------------------------------------------------------
Months_between (D1,D2)
Returns the number of months between D1, D2

New_time (D,Z1,Z2)
Returns the time zone Z1 Z2 time

Next_day (D,s)
Returns the next day that satisfies the condition s
s for the day of the week

Round (D,F)
Date d is rounded by format F

Sysdate
Returns the current time of the database

Trunc (D,F)
In format f truncate time D

In addition: the date can be directly added minus
such as: Sysdate +1,sysdate-1

------------------------------------------------------------

Sysdate+1 plus one day
sysdate+1/24 plus 1 hours
sysdate+1/(24*60) plus 1 minutes
sysdate+1/(24*60*60) plus 1 seconds
analogy to milliseconds 0.001 sec

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.