Pages

Sunday, January 8, 2012

How to convert date to char in oracle

In every dbms, conversion is something that almost always happen. In oracle, if we want to convert date to char we can use to_char() function. otherwise, if we want to convert char to date we can use to_date() function.
Below is the sample to_char() and to_date() usage in oracle :
select to_char(sysdate, 'DD/MM/YYYY HH24:MI:SS') from dual; select to_date('29/03/2012 08:18:45', 'DD/MM/YYYY HH24:MI:SS') from dual;
The first result will be the current date time of your database server
The second result will be '29/03/2012 08:18:45'.

No comments:

Post a Comment

Don't Forget To Join Our Community
×
Widget