TIME Function

Description

The TIME function extracts the time part from specified argument and returns it in the 'HH:MM:SS' format. You can specify the TIME, TIMESTAMP, or DATETIME type; the value is returned in VARCHAR type.

Syntax

TIME(time)

Example

SELECT TIME('12:34:56');

   time('12:34:56')

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

  '12:34:56.000'

 

SELECT TIME('2010-01-01 12:34:56');

   time('2010-01-01 12:34:56')

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

  '12:34:56.000'

 

SELECT TIME(datetime'2010-01-01 12:34:56');

   time(datetime '2010-01-01 12:34:56')

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

  '12:34:56.000'

 

SELECT TIME('invalid_string');

 

   ERROR: ERROR: Conversion error in time format.