Oracle:tochar (sysdate, ' D ') function

Source: Internet
Author: User

The ToChar (sysdate, ' D ') function was encountered while learning Oracle, but the discovery was not a day of the week, as today is 20150317, Tuesday, but the resulting value is 3

Started thinking it was the system date what's the reason that tried

Select To_char (to_date (' 20150317 ', ' yyyymmdd '), ' D ') from dual; the resulting value is still 3.

Search a lot of information only found that the 3 here and we understand that the 3 is not a concept, here 3 is the first day of one weeks, the foreign is Sunday count one weeks third days, so do not mix with the week.

Later found that there are several other optional parameters, put together for easy memory understanding, as follows:

Select To_char (sysdate, ' D ') from dual; The first day of the week

Select To_char (sysdate, ' DD ') from dual; the first day of the month

Select To_char (sysdate, ' DDD ') from dual; the first day of this year

Oracle:tochar (sysdate, ' D ') 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.