Oracle Date Format

Source: Internet
Author: User

I wish you all the best in 14 years.

Show the date and the week of the day:
SQL> select to_char (sysdate + level-1, 'yyyy-mm-dd') dt,
To_char (sysdate + level-1, 'aws') weeks from dual connect by level <= 15;
DT WE
------------
2014-01-03 01
2014-01-04 01
2014-01-05 01
2014-01-06 02
2014-01-07 02
2014-01-08 02
2014-01-09 02
2014-01-10 02
2014-01-11 02
2014-01-12 02
2014-01-13 03
2014-01-14 03
2014-01-15 03
2014-01-16 03
2014-01-17 03
15 rows selected.

Display the working day from Monday to Friday and the week of the day:

SQL> select to_char (sysdate + level-1, 'yyyy-mm-dd') dt,
To_char (sysdate + level-1, 'day') day,
To_char (sysdate + level-1, 'aws') weeks from dual where to_char (sysdate + level-1,
'D') not in (7,1) connect by level <= 15;
DT DAY WE
---------------------
Friday 01
Monday 02
Tuesday 02
Wednesday 02
Thursday 02
Friday 02
Monday 03
Tuesday 03
Wednesday 03
Thursday 03
Friday 03
11 rows selected.

Coming year:

Select to_char (sysdate + level, 'yyyymmdd'), to_char (sysdate + level, 'iw') from dual
Connect by level <= (select to_date (to_char (sysdate, 'yyyy') | '000000', 'yyyymmdd')-to_date (to_char (
Sysdate, 'yyyy') | '000000', 'yyyymmdd') + 1 from dual );

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.