Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Difference between to_char and to_date.

Jeevanantham VFeb 1 2017 — edited Feb 6 2017

Query 1 : select to_char(sysdate,'DD-MON-YYYY')  AS REQ_DATE  from dual;

REQ_DATE

---------

01-FEB-17

If i execute query 2:

select to_DATE(sysdate,'DD-MON-YYYY') AS REQ_DATE from dual;

REQ_DATE

-----------

01-FEB-2017.

Actually, i want to display the date format in "DD-MON-YYYY".  But, to_date function only displays "yy" not in "yyyy". Please explain the reason, as well the real purpose between these two functions in date related operations.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 6 2017
Added on Feb 1 2017
12 comments
30,090 views