time type
time data expresses a time without a specific date.
| Detail | Info |
|---|---|
| Quick Syntax | TIME '01:23:45' |
| Size | 4 bytes |
| Catalog name | pg_catalog.time |
| OID | 1083 |
| Min value | TIME '00:00:00' |
| Max value | TIME '23:59:59.999999' |
Syntax
| Field | Use |
|---|---|
| time_str | A string representing a time of day in H:M:S.NS format. |
Details
Valid casts
From time
You can cast time to:
To time
You can cast from the following types to time:
interval(by assignment)text(explicitly)timestamp(by assignment)timestamptz(by assignment)
Valid operations
time data supports the following operations with other types.
| Operation | Computes |
|---|---|
date + time |
timestamp |
time + interval |
time |
time - interval |
time |
time - time |
interval |
Examples
SELECT TIME '01:23:45' AS t_v;
t_v
----------
01:23:45
SELECT DATE '2001-02-03' + TIME '12:34:56' AS d_t;
d_t
---------------------
2001-02-03 12:34:56