TIME
The TIME data type stores 8-byte time of day values that do not include the date or time zone. If input values contain dates and time zones, they are ignored.
You cannot define a TIME column with a specific precision for fractional seconds. All TIME values support up to six fractional seconds; if additional fractional digits exist in input values, the time values are rounded up or down, as appropriate.
Values inserted with INSERT statements must fall between 00:00:00
and
24:00:00
. Values inserted with ybload
bulk loads must
fall between 00:00:00
and 23:59:59
. Time values may also
include the am
or pm
designation.
The following table shows examples of values that can be inserted into a TIME column.
Inserted Value | Stored Value | Notes |
---|---|---|
01:01:01 |
01:01:01 |
|
23:59:59.123 |
23:59:59.123 |
Three digits representing fractional seconds are inserted. |
00:00:00.999999 |
00:00:00.999999 |
Six digits representing fractional seconds are inserted. |
01:00:00.999999555 |
01:00:01.000000 |
The fractional seconds (9 digits) are rounded up. |
2017-05-25 00:00:00.9999999 GMT |
00:00:01 |
The date is ignored. The time zone is ignored. The fractional seconds (7 digits) are rounded up. |
24:00:00.123 |
Value out of range | Returns an error. |
02:02:45.6789pm |
14:02:45.6789 |
am and pm can be specified in uppercase or
lowercase. |
02:02:45.6789 am |
02:02:45.6789 |
The space before am or pm is optional.
|
premdb=# select time '12:00:00' - time '3:30:30' as timeleft
from sys.const;
timeleft
----------
08:29:30
(1 row)