Common Oracle date conversion

Source: Internet
Author: User

Common Oracle date Function Conversion:

1. select extract (year from sysdate) "year", // obtain the year

Extract (month from sysdate) "moth", // obtain the month

Extract (day from sysdate) "day" // get the day

From dual

2. Select to_char (sysdate, 'mm') from dual; // month

Select to_char (sysdate, 'yyyy') from dual; // year

Select to_char (sysdate, 'dd') from dual; // day

3. to_date ('1970-12-21 ', 'yyyy-mm-dd'); // The mm is case insensitive.

4. to_date ('2017-12-21 ', 'day mm/dd/yyyy ')

5. Check the day of the week.

Select to_char (to_date ('1970-12-21 ', 'yyyy-mm-dd'), 'day') from dual;

6. select trunc (sysdate, 'dd') from dual; // remove the hour, minute, and second.

7. select sysdate from dual; // system time

This article is suitable for beginners who are just getting started to learn and have mastered the basic knowledge of Oracle databases, so that you can gain a deeper understanding of Oracle databases, I hope the content mentioned above will be helpful to you.

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.