Monday, November 21, 2011

Converting DATETIME() to string in Oracle

oracle database Provide some special functions to convert the value from one data type to another data type.To_CHAR() function will be using to convert the DATE TIME() to string .

The syntax for TO_CHAR():

use TO_CHAR(x([,format]) to convert the date time x to string.here i want to get the full name of month ,2 digit day format and 4 digit year
SELECT student_id, TO_CHAR(dob, 'MONTH DD, YYYY')
FROM students;

note:The conversion of string to date time will be get by using TO_DATE () function.





No comments:

Bel