Scalar function
NULL value or NULL format yields NULL; non-NULL text that matches no pattern raises an error.
Syntax
Calls that evaluate time text with an omitted or constant format currently fail with a time-precision error. Use a format column that varies by row, as in the example below.
Arguments
Returns
- Type: TIME with microsecond precision
- NULL behavior: NULL value or NULL format yields NULL; non-NULL text that matches no pattern raises an error.
Properties
Usage notes
- The format can vary by row, such as
HH:mm:ss for one row and HH:mm for another.
- Square brackets mark optional parts of a pattern, such as
HH:mm[:ss].
Examples
The first row includes seconds; the second omits them, so its seconds are 00.
Parse 12-hour times with AM and PM
Limitations
- Calls that evaluate time text at runtime with an omitted or constant format currently fail with a time-precision error. Use the varying-format form shown in the example.
- Optional format sections expand to at most 256 candidate patterns. A value requiring a candidate outside that limit will not parse.
Last modified on October 15, 2026