The TO_TIMESTAMP function interprets a character string based on the time format given as an argument, converts it to a TIMESTAMP type value, and returns it. For the format, see TO_CHAR Function (date_time). If a format is not specified, the "HH:MI[:SS] [am|pm] MM/DD/YYYY" format is applied by default.
TO_TIMESTAMP(string_argument[, format_argument[,date_lang_string_literal]])
string_argument :
• character strings
• NULL
format_argument :
• character strings (see Date/Time Format 1 table)
• NULL
date_lang_string_literal : (see date_lang_string_literal table)
• 'en_US'
• 'ko_KR'
--selecting a timestamp type value casted from a string in the specified format
SELECT TO_TIMESTAMP('13:10:30 12/25/2008');
to_timestamp('13:10:30 12/25/2008')
======================================
01:10:30 PM 12/25/2008
SELECT TO_TIMESTAMP('08-Dec-25 13:10:30', 'YY-Mon-DD HH24:MI:SS');
to_timestamp('08-Dec-25 13:10:30', 'YY-Mon-DD HH24:MI:SS', 'en_US')
======================================
01:10:30 PM 12/25/2008
SELECT TO_TIMESTAMP('YEAR: 2008 DATE: 12-25 TIME: 13:10:30', '"YEAR:" YYYY "DATE:" MM-DD "TIME:" HH24:MI:SS');
to_timestamp('YEAR: 2008 DATE: 12-25 TIME: 13:10:30', '"YEAR:" YYYY "DATE:" MM-DD "TIME:" HH24:MI:SS', 'en_US')
======================================
01:10:30 PM 12/25/2008