date type
date
data expresses a date without a specified time.
Detail | Info |
---|---|
Quick Syntax | DATE '2007-02-01' |
Size | 1 byte |
Catalog name | pg_catalog.date |
OID | 1082 |
Min value | 4713 BC |
Max value | 5874897 AD |
Resolution | 1 day |
Syntax
Field | Use |
---|---|
date_str | A string representing a date in Y-M-D , Y M-D , Y M D or YMD format. |
time_str | (NOP) A string representing a time of day in H:M:S.NS format. |
tz_offset | (NOP) The timezone’s distance, in hours, from UTC. |
Details
Valid casts
From date
You can cast date
to:
text
(by assignment)timestamp
(implicitly)timestamptz
(implicitly)
To date
You can cast from the following types to date
:
text
(explicitly)timestamp
(by assignment)timestamptz
(by assignment)
Valid operations
time
data supports the following operations with other types.
Operation | Computes |
---|---|
date + interval |
timestamp |
date - interval |
timestamp |
date + time |
timestamp |
date - date |
interval |
Examples
SELECT DATE '2007-02-01' AS date_v;
date_v
------------
2007-02-01