The TO_DATE function interprets a character string based on the date format given as an argument, converts it to a DATE type value, and returns it. For the format, see TO_CHAR Function (date_time). If a format is not specified, the "MM/DD/YYYY" format is applied by default.
TO_DATE(string_argument[,format_argument[,date_lang_string_literal]])
string_argument :
• character strings
• NULL
format_argument :
• character strings (see Date/Time Format 1)
• NULL
date_lang_string_literal : (see date_lang_string_literal)
• 'en_US'
• 'ko_KR'
--selecting a date type value casted from a string in the specified format
SELECT TO_DATE('12/25/2008');
to_date('12/25/2008')
===============================================
12/25/2008
SELECT TO_DATE('25/12/2008', 'DD/MM/YYYY');
to_date('25/12/2008', 'DD/MM/YYYY', 'en_US')
===============================================
12/25/2008
SELECT TO_DATE('081225', 'YYMMDD');
to_date('081225', 'YYMMDD', 'en_US')
===============================================
12/25/2008
SELECT TO_DATE('2008-12-25', 'YYYY-MM-DD');
to_date('2008-12-25', 'YYYY-MM-DD', 'en_US')
===============================================
12/25/2008