|PostgreSQL Reference Manual - Volume 1 - SQL Language Reference|
by The PostgreSQL Global Development Group
Paperback (6"x9"), 716 pages
RRP £32.00 ($49.95)
Sales of this book support the PostgreSQL project! Get a printed copy>>>
220.127.116.11 Time Stamps
Valid input for the time stamp types consists of a concatenation
of a date and a time, followed by an optional time zone,
followed by an optional
BC can appear
before the time zone, but this is not the preferred ordering.)
1999-01-08 04:05:06 -8:00
are valid values, which follow the ISO 8601 standard. In addition, the wide-spread format
January 8 04:05:06 1999 PST
The SQL standard differentiates
timestamp without time zone
timestamp with time zone literals by the presence of a
“+” or “-”. Hence, according to the standard,
TIMESTAMP '2004-10-19 10:23:54'
timestamp without time zone, while
TIMESTAMP '2004-10-19 10:23:54+02'
timestamp with time zone.
PostgreSQL never examines the content of a
literal string before determining its type, and therefore will treat
both of the above as
timestamp without time zone. To
ensure that a literal is treated as
timestamp with time
zone, give it the correct explicit type:
TIMESTAMP WITH TIME ZONE '2004-10-19 10:23:54+02'
In a literal that has been decided to be
timestamp without time
zone, PostgreSQL will silently ignore
any time zone indication.
That is, the resulting value is derived from the date/time
fields in the input value, and is not adjusted for time zone.
timestamp with time zone, the internally stored
value is always in UTC (Universal
Coordinated Time, traditionally known as Greenwich Mean Time,
GMT). An input value that has an explicit
time zone specified is converted to UTC using the appropriate offset
for that time zone. If no time zone is stated in the input string,
then it is assumed to be in the time zone indicated by the system's
timezone parameter, and is converted to UTC using the
offset for the
timestamp with time
zone value is output, it is always converted from UTC to the
timezone zone, and displayed as local time in that
zone. To see the time in another time zone, either change
timezone or use the
AT TIME ZONE construct
AT TIME ZONE).
timestamp without time zone and
timestamp with time zone normally assume that the
timestamp without time zone value should be taken or given
timezone local time. A different zone reference can
be specified for the conversion using
AT TIME ZONE.
|ISBN 0954612027||PostgreSQL Reference Manual - Volume 1 - SQL Language Reference||See the print edition|