In-depth understanding of oracle datetime timestamp

Source: Internet
Author: User

In-depth understanding of oracle datetime timestamp
We all know that date and timestamp are both expressions of date and time, but the two types of precision are different. The former is accurate to seconds, and the latter is precise to decimal seconds, which can be 0 to 9, the default value is 6. The timestamp function is described in detail. 1. Convert the struct type to timestamp select to_timestamp ('01-August 15, October-07.46.41.000000000 am ', 'dd-MON-yy hh: mi: ss. ff AM ') from dual; 2. Convert timestamp to date type select cast (to_timestamp ('01-August 15, October-07.46.41.000000000 AM', 'dd-MON-yy hh: mi: ss. ff AM ') as date) timestamp_to_date from dual; 3. Convert the date type to timestamp select cast (sysdate as timestamp) date_to_timestamp from dual; 4. Obtain the system time in timestamp format select systimestamp from dual; 5. Subtract the date of two dates The result is the number of days, while the two timestamp dates subtract the complete year, month, day, hour, minute, second decimal second select systimestamp-policimestamp from dual; select sysdate-sysdate from dual; note: timestamp: calculate the number of seconds between the two dates. Use a function to convert them.

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.