TRY_TO_TIME

functionsupportedCore SQL functions

docs.snowflake.com ↗

Conversion functions

A special version of TO_TIME , TIME that performs the same operation (i.e. converts an input expression into a time), but with error-handling support (i.e. if the conversion cannot be performed, it returns a NULL value instead of raising an error). For more information, see Error-handling conversion functions.

Syntax

supportedpartialnot supportednot scored

TRY_TO_TIME( <string_expr> [, <format> ] )
TRY_TO_TIME( '<integer>' )

Parameters

NameRequiredDescription
string_exprrequiredA string that can be converted to a valid time.
'integer'requiredAn expression that evaluates to a string containing an integer, for example '15000000'. Depending on the magnitude of the string, it can be interpreted as seconds, milliseconds, microseconds, or nanoseconds. For details, see the Usage Notes.
formatoptionalFormat specifier for string_expr or AUTO. For more information, see Date and time formats in conversion functions. The default is the current value of the TIME_INPUT_FORMAT session parameter (default AUTO).

Returns

The data type of the returned value is TIME.

Usage notes

See also

Referenced by