Time
Data type Time
represents a time with hour, minute, and second components.
It is independent of any calendar date and is suitable for values which do not need day, months and year components.
Syntax:
Text representation range: [-999:59:59, 999:59:59].
Resolution: 1 second.
Implementation details
Representation and Performance.
Data type Time
internally stores a signed 32-bit integer that encodes the seconds.
Values of type Time
and DateTime
have the same byte size and thus comparable performance.
Normalization.
When parsing strings to Time
, the time components are normalized and not validated.
For example, 25:70:70
is interpreted as 26:11:10
.
Negative values.
Leading minus signs are supported and preserved.
Negative values typically arise from arithmetic operations on Time
values.
For Time
type, negative inputs are preserved for both text (e.g., '-01:02:03'
) and numeric inputs (e.g., -3723
).
Saturation.
The time-of-day component is capped to the range [-999:59:59, 999:59:59].
Values with hours beyond 999 (or below -999) are represented and round-tripped via text as 999:59:59
(or -999:59:59
).
Time zones.
Time
does not support time zones, i.e. Time
value are interpreted without regional context.
Specifying a time zone for Time
as a type parameter or during value creation throws an error.
Likewise, attempts to apply or change the time zone on Time
columns are not supported and result in an error.
Time
values are not silently reinterpreted under different time zones.
Examples
1. Creating a table with a Time
-type column and inserting data into it:
2. Filtering on Time
values
Time
column values can be filtered using a string value in WHERE
predicate. It will be converted to Time
automatically:
3. Inspecting the resulting type: