Time
The Time
data type is used to store a time value independent of any calendar date. It is ideal for representing daily schedules, event times, or any situation where only the time component (hours, minutes, seconds) is important.
Syntax:
Supported range of values: [-999:59:59, 999:59:59].
Resolution: 1 second.
Speed
The Date
data type is faster than Time
under most conditions. But the Time
data type is around the same as DateTime
data type.
Due to the implementation details, the Time
and DateTime
type requires 4 bytes of storage, while Date
requires 2 bytes. However, when the database compresses the database, this difference is amplified.
Usage Remarks
The point in time is saved as a Unix timestamp, regardless of the time zone or daylight saving time.
Note: The Time data type does not observe time zones. It represents a time‐of‐day value on its own, without any date or regional offset context. Attempting to apply or change a time zone on Time columns has no effect and is not supported.
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. Getting a time zone for a Time
-type column: