Oracle database time a year ago one months before the day before

Source: Internet
Author: User


1. Get the date a week before the current time


Select Sysdate-interval ' 7 ' from dual

Similar to
Current time minus 7 minutes of time
Select Sysdate,sysdate-interval ' 7 ' MINUTE from dual
The current time minus 7 hours of time
Select Sysdate-interval ' 7 ' hour from dual
The current time minus 7 days
Select Sysdate-interval ' 7 ' from dual
Current time minus July time
Select Sysdate,sysdate-interval ' 7 ' month from dual
The current time minus 7 years time
Select Sysdate,sysdate-interval ' 7 ' from dual
Time interval multiplied by a number
Select Sysdate,sysdate-8 *interval ' 2 ' hour from dual

2, get the current time one months ago date
Select Add_months (sysdate,-1) from dual
3. Get the date of the current time one year ago


Select Add_months (sysdate,-12) from dual
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.