Oracle 10 Gb time processing (2)

Source: Internet
Author: User

 

-- Add one minute to the specified time

SELECT to_char (to_date ('2017-11-09 15:30:30 ', 'yyyy-MM-DD HH24: MI: ss') + (2011), 'yyyy-MM-DD HH24: MI: SS ') as newDate FROM dual;

 

 

-- Subtract two times

Select to_date ('2017-11-09 15:30:30 ', 'yyyy-MM-DD HH24: MI: ss')-to_date ('2017-10-09 15:30:30 ', 'yyyy/MM/DD HH24: MI: ss') from dual

 

 

-- Minus 10 minutes

Select sysdate, sysdate-interval '10' minute as "Current Time-10 minutes" from dual;

-- Result: 5:09:34, 4:59:34

 

 

-- Minus 10 hours

Select sysdate, sysdate-interval '10' hour as "Current Time-10 minutes" from dual;

-- Result: 5:10:59, 7:10:59 AM

 

 

-- Minus 10 days

Select sysdate, sysdate-interval '10' day as "Current Time-10 minutes" from dual;

-- Result: 5:11:42, 5:11:42

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.