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

494 total views, 1 views today

Leave a Reply

Your email address will not be published. Required fields are marked *