ORACLE Date Function Add_months

Source: Internet
Author: User

Format: add_months (Date,number) that is add_months (date, number)

The Add_months function returns a new date by adding a specified number of months to the input date. If a negative number is given, the date of the month before the duty period is returned.

Number in add_months (Date,number) should be an integer, given a decimal, positive numbers are truncated to the largest integer less than that number, and negative numbers are truncated to the smallest integer greater than that number.

Example: Add_months (to_date (' 29-feb-96 ', ' d-mon-yyyy '),-12.99) back to 28-feb-95

Note: The previous example in 29 was adjusted to 28 because the last day of February 96 was 29th, and the last day in February 95 was 28th.

Add_months (to_date (' 15-nov-1961 ', ' d-mon-yyyy '), 1) back to 15-dec-1961

Add_months (to_date (' 30-nov-1961 ', ' d-mon-yyyy '), 1) back to 31-dec-1961

Note: Adjust from 30 to 31, in order to keep all the corresponding last day.

Add_months (to_date (' 31-jan-1999 ', ' d-mon-yyyy '), 1) back to 28-feb-1999

Note: The function will be 31st to 28th to make the result pair downsizing the last day of January, since February 1999 is only 28 days.

ORACLE Date Function Add_months

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.