Oracle Next_day,add_month functions

Source: Internet
Author: User

Next_day () Gets the date of the next one days of the current date, from the literal meaning easily understood to be the date of the following day to get the current date. For example: Select Next_day (to_date (' 20160330 ', ' YYYYMMDD '), 1) from dual; The return result is 20160403. The argument can be a number 1-7 or a date monday-sunday get the week of the next week.

Another commonly used Oracle Date function: Add_months () Gets the date of the previous or subsequent months of the current date. When the parameter is a positive number, the date of the current date is increased by several months, and the argument is negative to get the current date minus the date of the corresponding month.

For example: Select Add_months (to_date (' 20160330 ', ' YYYYMMDD '), 1) from dual; return value 20160430

Select Add_months (to_date (' 20160330 ', ' YYYYMMDD '), -1) from dual; return value 20160229

If the date of the current month is greater than the date of the conversion month, for example, March 2016 30,31 is converted to the last one months, because February totals only 29 days, the March 29,30,31 minus one month's date return value is 20160229

This article is from "Flying snail" blog, please be sure to keep this source http://10794883.blog.51cto.com/10784883/1794440

Oracle Next_day,add_month functions

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.