Oracle Time Processing

Source: Internet
Author: User

-- Query Date language type

Select * from v$nls_parameters;

Select * fromnls_session_parameters

--to_date (NULL) the usage (insert NULL Field ?? )

Select 1, to_date (null) from dual;

-- actual Time 2012-12-04 18:22 The test results are as follows:

--24 Hour display mode --- requires HH24:mi:ss this form

Select to_char (sysdate,' yyyy-mm-dd HH24:mi:ss ') from dual; --mi is the minute 2012-12-04 18:22:06

Select to_char (sysdate,' yyyy-mm-dd HH24:mm:ss ') from dual; --MM will display the month 2012-12-04 18:12:15

--12 Hour system display mode

select to_char ( Span lang= "en-us" xml:lang= "en-US" >sysdate ' yyyy-mm-dd HH:mi:ss ' )  from dual; --mi is minutes    2012-12-04 06:22:58

Select to_char (sysdate,' yyyy-mm-dd HH:mm:ss ') from dual; --MM will display the month 2012-12-04 06:12:21

--2012-12-04 What day of the week? Tuesday

Selectto_char (to_date (' 2012-12-04 ',' Yyyy-mm-dd '),' Day ') from dual;

--2012-12-04 What day of the week? Tuesday (in American language Display)

Selectto_char (to_date (' 2012-12-04 ',' Yyyy-mm-dd '),' Day ',' nls_date_language = American ') from dual;

--2012-12-04 the Month A Month

Selectto_char (to_date (' 2012-12-04 ',' Yyyy-mm-dd '),' MONTH ') from dual;

--2012-12-04 the Month December (in American language Display)

Select to_char (to_date (' 2012-12-04 ',' Yyyy-mm-dd '),' MONTH ',' nls_date_language = American ') fromdual;

Here is the format of the to_date found online:

to_date format (Take time : 2007-11-02 13:45:25 as an example )

Year:

YY two digits two-digit year display value :

YYY three digits three-bit year display value : 007

YYYY four digits four-digit year display value :

Month:

MM number two-bit month display value : One

The Mon abbreviated character set represents the display value : November , if the English version shows the

The month spelled out character set represents the display value : November , if the English version , display November

Day:

DD Number the day of the month displays the value :

DDD Number the day of the year displays the value :

DY abbreviated when in days abbreviated display value : Friday , if the English version , display Fri

Day spelled out when in days full write display value : Friday , if the English version , display Friday

Ddspth spelled out, ordinal twelfth

Hour:

HH-Digits 12-hour binary display value :

Hh24 digits 24-hour binary display value :

Minute:

MI digits 60 binary display value :

Second:

SS-Digits 60 binary display value :

Other

Q Digit Quarterly display value : 4

WW Digit The first few weeks of the year display value :

W Digit The week of the month display value : 1

The time range in the 24-hour format is: 0:00:00-23:59:59 ....

         12-hour format time range:  1:00:00-12:59:59 ....

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.