Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 |  CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

TO_TIMESTAMP Function

Description

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.

Syntax

TO_TIMESTAMP(string_argument[, format_argument[,date_lang_string_literal]])

 

string_argument :

? character strings

? NULL

 

format_argument :

? character strings (refer to Date/Time Format 1 table)

? NULL

 

date_lang_string_literal : (refer to date_lang_string_literal table)

? 'en_US'

? 'ko_KR'

  • string_argument : Specifies an expression that returns character string. If the value is NULL, NULL is returned.
  • format_argument : Specifies a format of return value to be converted as TIMESTAMP type. See the "Default Date-Time Format" table of TO_CHAR Function (date_time). If the value is NULL, NULL is returned.
  • date_lang_string_literal : Specifies the language for the input value to be applied. You can modify the value by using the CUBRID_DATE_LANG environment.
Example

--selecting a timestamp type value casted from a string in the specified format

 

SELECT 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');

======================================

  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');

======================================

  01:10:30 PM 12/25/2008