Skip to main content

TIME type

The TIME type is only supported to preserve backwards compatibility of supporting DATE + TIME. TIME is only allowed in the context of combiningTIME with a DATE to create a TIMESTAMP using the + operator, in all other cases a validation error will be thrown.

It is recommended to use INTERVAL HOUR TO SECOND instead of TIME in all cases.

Syntax

TIME

Literals

TIME literals must conform to the format of INTERVAL HOUR TO SECOND literals as they will be converted to that type before being executed on the underlying target engine.

Examples

-- Casting a TIMESTAMP to TIME
> SELECT DATE '2025-01-01' + CAST(TIMESTAMP '1970-01-01 12:34:56' AS TIME);
2025-01-01 12:34:56

-- TIME literal
> SELECT DATE '2025-01-01' + TIME '12:34:56';
2025-01-01 12:34:56

-- Casting VARCHAR to TIME.
> SELECT DATE '2025-01-01' + CAST('12:34:56' AS TIME);
2025-01-01 12:34:56

-- Disallowed usages
> SELECT CAST(TIME '12:34:56' AS VARCHAR);
ERROR

> SELECT CAST(TIME '12:34:56' AS TIMESTAMP);
ERROR