Oracle Date function

Source: Internet
Author: User

Years:

YY: two-year 16

YYY: three-year 016

YYYY: four-year 2016

Quarter

Q: Return to Quarter

Month

Mm:

MON:

MONTH:

Week

Ww:

W:

Days

Dd:

Ddd:

Dy:

Day:

Hours

HH:

HH24:

Score of

MI:

Seconds

Ss:

1. Get the current system date
-- returns the current system date SELECT  from DUAL;
2. Returns the year of the system date
    • Two-year
SELECT to_char (sysdate, ' YY ') from DUAL;
    • Three-year
Select To_char (sysdate,'YYY') from DUAL;
    • Four-year
SELECT To_char (sysdate,'YYYY' from DUAL;
3. Return to Quarter
SELECT To_char (sysdate,'Q' from DUAL;
4. Month of return date

Month Number:

SELECT To_char (sysdate,'MM' from DUAL;

English abbreviations for the month:

SELECT To_char (sysdate,'MON' from DUAL;

Month Full English:

SELECT To_char (sysdate,'MONTH' from DUAL;
5. Return to week

The first few weeks of the year

SELECT To_char (sysdate,'WW' from DUAL;

The week ordinal of the month

SELECT To_char (sysdate,'W' from DUAL;
6. Number of days to return a date

Day ordinal of the month

SELECT To_char (sysdate,'DD' from DUAL;

The day of the year

   SELECT to_char (sysdate, ' DDD ') from DUAL;  

Week of the week abbreviations

SELECT To_char (sysdate,'DY' from DUAL;

The full name of the week

SELECT To_char (Sysdate,"Day" from DUAL;
7. Return hours
12:  Select to_char (sysdate,'HH' from DUAL; 24:Select to_ CHAR (sysdate,'HH24' from DUAL;

Returns the minute of the time

SELECT to_char (sysdate, ' MI ') from DUAL;
8. Return seconds
SELECT To_char (sysdate,'SS' from DUAL;

Oracle Date function

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.