mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
doc: add example of sign mismatch with POSIX/ISO-8601 time zones
Author: Laurenz Albe Discussion: https://postgr.es/m/eb4d1e15c6822c1937be1491118500dd9201492f.camel@cybertec.at
This commit is contained in:
@ -2682,6 +2682,14 @@ TIMESTAMP WITH TIME ZONE '2004-10-19 10:23:54+02'
|
|||||||
savings was nominally in effect on that date.
|
savings was nominally in effect on that date.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<para>
|
||||||
|
The sign in POSIX-style time zone specifications has the opposite meaning
|
||||||
|
of the sign in ISO-8601 datetime values. For example, the POSIX time zone
|
||||||
|
for <literal>2014-06-04 12:00+04</literal> would be UTC-4.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
To complicate matters, some jurisdictions have used the same timezone
|
To complicate matters, some jurisdictions have used the same timezone
|
||||||
abbreviation to mean different UTC offsets at different times; for
|
abbreviation to mean different UTC offsets at different times; for
|
||||||
|
@ -11006,6 +11006,8 @@ SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'Asia/Tokyo' AT TIME ZONE 'A
|
|||||||
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 05:38:40</computeroutput>
|
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 05:38:40</computeroutput>
|
||||||
SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT LOCAL;
|
SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT LOCAL;
|
||||||
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 17:38:40</computeroutput>
|
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 17:38:40</computeroutput>
|
||||||
|
SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE '+05';
|
||||||
|
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 20:38:40</computeroutput>
|
||||||
SELECT TIME WITH TIME ZONE '20:38:40-05' AT LOCAL;
|
SELECT TIME WITH TIME ZONE '20:38:40-05' AT LOCAL;
|
||||||
<lineannotation>Result: </lineannotation><computeroutput>17:38:40</computeroutput>
|
<lineannotation>Result: </lineannotation><computeroutput>17:38:40</computeroutput>
|
||||||
</screen>
|
</screen>
|
||||||
@ -11018,11 +11020,14 @@ SELECT TIME WITH TIME ZONE '20:38:40-05' AT LOCAL;
|
|||||||
Tokyo time to Chicago time. The fourth example shifts the time stamp
|
Tokyo time to Chicago time. The fourth example shifts the time stamp
|
||||||
with time zone value to the time zone currently specified by the
|
with time zone value to the time zone currently specified by the
|
||||||
<varname>TimeZone</varname> setting and returns the value without a
|
<varname>TimeZone</varname> setting and returns the value without a
|
||||||
time zone.
|
time zone. The fifth example demonstrates that the sign in a POSIX-style
|
||||||
|
time zone specification has the opposite meaning of the sign in an
|
||||||
|
ISO-8601 datetime literal, as described in <xref linkend="datatype-timezones"/>
|
||||||
|
and <xref linkend="datetime-appendix"/>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The fifth example is a cautionary tale. Due to the fact that there is no
|
The sixth example is a cautionary tale. Due to the fact that there is no
|
||||||
date associated with the input value, the conversion is made using the
|
date associated with the input value, the conversion is made using the
|
||||||
current date of the session. Therefore, this static example may show a wrong
|
current date of the session. Therefore, this static example may show a wrong
|
||||||
result depending on the time of the year it is viewed because
|
result depending on the time of the year it is viewed because
|
||||||
|
Reference in New Issue
Block a user