timestamp Data Type
timestamp
and timestamptz
data expresses a date and time in UTC.
Detail | Info |
---|---|
Quick Syntax | TIMESTAMP '2007-02-01 15:04:05' TIMESTAMPTZ '2007-02-01 15:04:05+06' |
Size | 8 bytes |
Min value | 4713 BC |
Max value | 294276 AD |
Resolution | 1 microsecond / 14 digits |
Syntax
TIMESTAMP
TIMESTAMPTZ
Field | Use |
---|---|
tz_offset | The timezone’s distance, in hours, from UTC. |
Details
timestamp
andtimestamptz
store data in UTC.- The difference between the two types is that
timestamptz
can read or write timestamps with the offset specified by the timezone. Importantly,timestamptz
itself doesn’t store any timezone data; Materialize simply performs the conversion from the time provided and UTC. - Materialize assumes all clients expect UTC time, and does not currently support any other timezones.
Valid casts
From timestamp
You can cast timestamp
or timestamptz
to:
To timestamp
You cannot cast timestamp
or timestamptz
to any other type.
Notably, you also cannot cast between timestamp
and timestamptz
.
Examples
SELECT TIMESTAMP '2007-02-01 15:04:05' AS ts_v;
ts_v
---------------------
2007-02-01 15:04:05
SELECT TIMESTAMPTZ '2007-02-01 15:04:05+06' AS tstz_v;
tstz_v
-------------------------
2007-02-01 09:04:05 UTC