Skip to main content

TO_TIME

Categories: Date/Time, Conversion

TO_TIME

Converts the input expressions to the corresponding time.

Syntax

TO_TIME(numeric_expression int32) → time

  • numeric_expression: A Unix epoch timestamp.

Examples

TO_TIME example
SELECT TO_TIME(1665131223)
-- 08:27:03

TO_TIME(numeric_expression int64) → time

  • numeric_expression: A Unix epoch timestamp.

Examples

TO_TIME example
SELECT TO_TIME(1665131223)
-- 08:27:03

TO_TIME(string_expression varchar, format varchar, replaceErrorWithNull int32) → time

  • string_expression: The string from which to extract the time.
  • format: String to specify format of the time.
  • replaceErrorWithNull: If 0, the function will fail when given malformed input. If 1, the function will return NULL when given malformed input.

Examples

TO_TIME example
SELECT TO_TIME('09:15:00.23232', 'HH:MI:SS', 1)
-- NULL

TO_TIME(string_expression varchar, format varchar) → time

  • string_expression: The string from which to extract the time.
  • format: String to specify format of the time.

Examples

TO_TIME example
SELECT TO_TIME('09:15:00', 'HH:MI:SS')
-- 09:15:00

TO_TIME(numeric_expression double) → time

  • numeric_expression: A Unix epoch timestamp.

Examples

TO_TIME example
SELECT TO_TIME(1665131223.69)
-- 08:27:03

TO_TIME(numeric_expression float) → time

  • numeric_expression: A Unix epoch timestamp.

Examples

TO_TIME example
SELECT TO_TIME(1665131223.69)
-- 08:27:03