Skip to content

Commit fa44348

Browse files
committed
Doc: add info about timestamps with fractional-minute UTC offsets.
Our code has supported fractional-minute UTC offsets for ages, but there was no mention of the possibility in the main docs, and only a very indirect reference in Appendix B. Improve that. Discussion: https://postgr.es/m/162543102827.697.5755498651217979813@wrigleys.postgresql.org
1 parent 2f48711 commit fa44348

File tree

1 file changed

+38
-8
lines changed

1 file changed

+38
-8
lines changed

doc/src/sgml/datatype.sgml

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,19 +1977,27 @@ MINUTE TO SECOND
19771977
</row>
19781978
<row>
19791979
<entry><literal>04:05:06.789-8</literal></entry>
1980-
<entry>ISO 8601</entry>
1980+
<entry>ISO 8601, with time zone as UTC offset</entry>
19811981
</row>
19821982
<row>
19831983
<entry><literal>04:05:06-08:00</literal></entry>
1984-
<entry>ISO 8601</entry>
1984+
<entry>ISO 8601, with time zone as UTC offset</entry>
19851985
</row>
19861986
<row>
19871987
<entry><literal>04:05-08:00</literal></entry>
1988-
<entry>ISO 8601</entry>
1988+
<entry>ISO 8601, with time zone as UTC offset</entry>
19891989
</row>
19901990
<row>
19911991
<entry><literal>040506-08</literal></entry>
1992-
<entry>ISO 8601</entry>
1992+
<entry>ISO 8601, with time zone as UTC offset</entry>
1993+
</row>
1994+
<row>
1995+
<entry><literal>040506+0730</literal></entry>
1996+
<entry>ISO 8601, with fractional-hour time zone as UTC offset</entry>
1997+
</row>
1998+
<row>
1999+
<entry><literal>040506+07:30:00</literal></entry>
2000+
<entry>UTC offset specified to seconds (not allowed in ISO 8601)</entry>
19932001
</row>
19942002
<row>
19952003
<entry><literal>04:05:06 PST</literal></entry>
@@ -2025,25 +2033,29 @@ MINUTE TO SECOND
20252033
<entry><literal>PST8PDT</literal></entry>
20262034
<entry>POSIX-style time zone specification</entry>
20272035
</row>
2036+
<row>
2037+
<entry><literal>-8:00:00</literal></entry>
2038+
<entry>UTC offset for PST</entry>
2039+
</row>
20282040
<row>
20292041
<entry><literal>-8:00</literal></entry>
2030-
<entry>ISO-8601 offset for PST</entry>
2042+
<entry>UTC offset for PST (ISO 8601 extended format)</entry>
20312043
</row>
20322044
<row>
20332045
<entry><literal>-800</literal></entry>
2034-
<entry>ISO-8601 offset for PST</entry>
2046+
<entry>UTC offset for PST (ISO 8601 basic format)</entry>
20352047
</row>
20362048
<row>
20372049
<entry><literal>-8</literal></entry>
2038-
<entry>ISO-8601 offset for PST</entry>
2050+
<entry>UTC offset for PST (ISO 8601 basic format)</entry>
20392051
</row>
20402052
<row>
20412053
<entry><literal>zulu</literal></entry>
20422054
<entry>Military abbreviation for UTC</entry>
20432055
</row>
20442056
<row>
20452057
<entry><literal>z</literal></entry>
2046-
<entry>Short form of <literal>zulu</literal></entry>
2058+
<entry>Short form of <literal>zulu</literal> (also in ISO 8601)</entry>
20472059
</row>
20482060
</tbody>
20492061
</tgroup>
@@ -2393,6 +2405,24 @@ TIMESTAMP WITH TIME ZONE '2004-10-19 10:23:54+02'
23932405
</tgroup>
23942406
</table>
23952407

2408+
<para>
2409+
In the <acronym>ISO</acronym> style, the time zone is always shown as
2410+
a signed numeric offset from UTC, with positive sign used for zones
2411+
east of Greenwich. The offset will be shown
2412+
as <replaceable>hh</replaceable> (hours only) if it is an integral
2413+
number of hours, else
2414+
as <replaceable>hh</replaceable>:<replaceable>mm</replaceable> if it
2415+
is an integral number of minutes, else as
2416+
<replaceable>hh</replaceable>:<replaceable>mm</replaceable>:<replaceable>ss</replaceable>.
2417+
(The third case is not possible with any modern time zone standard,
2418+
but it can appear when working with timestamps that predate the
2419+
adoption of standardized time zones.)
2420+
In the other date styles, the time zone is shown as an alphabetic
2421+
abbreviation if one is in common use in the current zone. Otherwise
2422+
it appears as a signed numeric offset in ISO 8601 basic format
2423+
(<replaceable>hh</replaceable> or <replaceable>hhmm</replaceable>).
2424+
</para>
2425+
23962426
<para>
23972427
The date/time style can be selected by the user using the
23982428
<command>SET datestyle</command> command, the <xref

0 commit comments

Comments
 (0)