Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 06dc1ff

Browse files
committed
doc: add example of sign mismatch with POSIX/ISO-8601 time zones
Author: Laurenz Albe Discussion: https://postgr.es/m/eb4d1e15c6822c1937be1491118500dd9201492f.camel@cybertec.at
1 parent a1f7f80 commit 06dc1ff

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

doc/src/sgml/datatype.sgml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2682,6 +2682,14 @@ TIMESTAMP WITH TIME ZONE '2004-10-19 10:23:54+02'
26822682
savings was nominally in effect on that date.
26832683
</para>
26842684

2685+
<note>
2686+
<para>
2687+
The sign in POSIX-style time zone specifications has the opposite meaning
2688+
of the sign in ISO-8601 datetime values. For example, the POSIX time zone
2689+
for <literal>2014-06-04 12:00+04</literal> would be UTC-4.
2690+
</para>
2691+
</note>
2692+
26852693
<para>
26862694
To complicate matters, some jurisdictions have used the same timezone
26872695
abbreviation to mean different UTC offsets at different times; for

doc/src/sgml/func.sgml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11006,6 +11006,8 @@ SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'Asia/Tokyo' AT TIME ZONE 'A
1100611006
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 05:38:40</computeroutput>
1100711007
SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT LOCAL;
1100811008
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 17:38:40</computeroutput>
11009+
SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE '+05';
11010+
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 20:38:40</computeroutput>
1100911011
SELECT TIME WITH TIME ZONE '20:38:40-05' AT LOCAL;
1101011012
<lineannotation>Result: </lineannotation><computeroutput>17:38:40</computeroutput>
1101111013
</screen>
@@ -11018,11 +11020,14 @@ SELECT TIME WITH TIME ZONE '20:38:40-05' AT LOCAL;
1101811020
Tokyo time to Chicago time. The fourth example shifts the time stamp
1101911021
with time zone value to the time zone currently specified by the
1102011022
<varname>TimeZone</varname> setting and returns the value without a
11021-
time zone.
11023+
time zone. The fifth example demonstrates that the sign in a POSIX-style
11024+
time zone specification has the opposite meaning of the sign in an
11025+
ISO-8601 datetime literal, as described in <xref linkend="datatype-timezones"/>
11026+
and <xref linkend="datetime-appendix"/>.
1102211027
</para>
1102311028

1102411029
<para>
11025-
The fifth example is a cautionary tale. Due to the fact that there is no
11030+
The sixth example is a cautionary tale. Due to the fact that there is no
1102611031
date associated with the input value, the conversion is made using the
1102711032
current date of the session. Therefore, this static example may show a wrong
1102811033
result depending on the time of the year it is viewed because

0 commit comments

Comments
 (0)