Oracle get the end of the year, the end of the month, the end of the quarter, the end of the oracle month

Source: Internet
Author: User

Oracle get the end of the year, the end of the month, the end of the quarter, the end of the oracle month

1 -- early year, end 2 select trunc (sysdate, 'yyyy') from dual; 3 select add_months (trunc (sysdate, 'yyyy'), 12)-1 from dual; 4 5 -- early month, end 6 select trunc (sysdate, 'month') from dual; 7 select add_months (trunc (sysdate, 'month'), 1)-1 from dual; 8 9 -- select trunc (sysdate, 'q') from dual; 11 select add_months (trunc (sysdate, 'q'), 3)-1 from dual;

 

If the end of the previous year is required, only one day is required for the beginning of the year. For the beginning of the next year, only one day is required for the end of the year.

Corresponding to the day before the end of the month, the day after the end of the month, the day before the beginning of the quarter, and the day after the end of the quarter, you only need to add one day or minus one day.

 

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.