Difference Between to_char and to_date with example

to_char:
to_char converts a date to string.

Query:
Select to_char(sysdate) from dual;
Output:
25-NOV-13

Query:
Select to_char(sysdate,’DD-MM-YYYY’) from dual;
Output:
25-11-2013

to_date:
to_date converts a string to date.

Query:
Select to_date(sysdate) from dual;
Output:
25-NOV-13

Query:
Select to_date(sysdate,’DD-MM-YYYY’) from dual;
Output:
25-NOV-13

850 total views, 2 views today

About Mirthbees 681 Articles
Blogger, Innovator, Developer and Enterpreneur. Founder of GuruRecharge, Readymade online recharge script. Lead Developer in Bookrate.in

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.