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 converts a string to TIMESTAMP type according to the date-time format.

Syntax

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

string_argument :
character strings
NULL

format_argument :
character strings (see the Date-Time Format table)
NULL

date_lang_string_literal : (see the date_lang_string_literal table)
'en_US'
'ko_KR'

  • string_argument : Specifies the string to be converted to TIMESTAMP type. If the value is NULL, NULL is returned.
  • format_argument : Specifies the format by which an input string is to be interpreted. If the value is NULL, NULL is returned. If this argument is omitted, the default format 'HH:MI[:SS] [am|pm] MM/DD/YYYY' is used to interpret character strings.
  • date_lang_string_literal : Specifies the language for the return value. You can modify the value using the CUBRID_DATE_LANG environment variable.
Example
  • Example 1
  • The following is an example that converts a string to TIMESTAMP type according to the default format.

SELECT TO_TIMESTAMP('10:30:20 AM 12/25/1999') FROM db_root;

  • Result : 1999-12-25 10:30:20
  • Example 2
  • The following is an example that converts a string to TIMESTAMP type according to the specified format.

SELECT TO_TIMESTAMP('YEAR: 1999 MONTH: 12 DAY: 25 HOUR: 10 MINUTE: 30 SECOND: 20','"YEAR:" YYYY "MONTH:" MM "DAY:" DD "HOUR:" HH24 "MINUTE:" MI "SECOND:" SS') FROM db_root;

  • Result : 1999-12-25 10:30:20