Skip to content

Commit 151d30e

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 76c23bb commit 151d30e

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
@@ -1932,19 +1932,27 @@ MINUTE TO SECOND
19321932
</row>
19331933
<row>
19341934
<entry><literal>04:05:06.789-8</literal></entry>
1935-
<entry>ISO 8601</entry>
1935+
<entry>ISO 8601, with time zone as UTC offset</entry>
19361936
</row>
19371937
<row>
19381938
<entry><literal>04:05:06-08:00</literal></entry>
1939-
<entry>ISO 8601</entry>
1939+
<entry>ISO 8601, with time zone as UTC offset</entry>
19401940
</row>
19411941
<row>
19421942
<entry><literal>04:05-08:00</literal></entry>
1943-
<entry>ISO 8601</entry>
1943+
<entry>ISO 8601, with time zone as UTC offset</entry>
19441944
</row>
19451945
<row>
19461946
<entry><literal>040506-08</literal></entry>
1947-
<entry>ISO 8601</entry>
1947+
<entry>ISO 8601, with time zone as UTC offset</entry>
1948+
</row>
1949+
<row>
1950+
<entry><literal>040506+0730</literal></entry>
1951+
<entry>ISO 8601, with fractional-hour time zone as UTC offset</entry>
1952+
</row>
1953+
<row>
1954+
<entry><literal>040506+07:30:00</literal></entry>
1955+
<entry>UTC offset specified to seconds (not allowed in ISO 8601)</entry>
19481956
</row>
19491957
<row>
19501958
<entry><literal>04:05:06 PST</literal></entry>
@@ -1980,25 +1988,29 @@ MINUTE TO SECOND
19801988
<entry><literal>PST8PDT</literal></entry>
19811989
<entry>POSIX-style time zone specification</entry>
19821990
</row>
1991+
<row>
1992+
<entry><literal>-8:00:00</literal></entry>
1993+
<entry>UTC offset for PST</entry>
1994+
</row>
19831995
<row>
19841996
<entry><literal>-8:00</literal></entry>
1985-
<entry>ISO-8601 offset for PST</entry>
1997+
<entry>UTC offset for PST (ISO 8601 extended format)</entry>
19861998
</row>
19871999
<row>
19882000
<entry><literal>-800</literal></entry>
1989-
<entry>ISO-8601 offset for PST</entry>
2001+
<entry>UTC offset for PST (ISO 8601 basic format)</entry>
19902002
</row>
19912003
<row>
19922004
<entry><literal>-8</literal></entry>
1993-
<entry>ISO-8601 offset for PST</entry>
2005+
<entry>UTC offset for PST (ISO 8601 basic format)</entry>
19942006
</row>
19952007
<row>
19962008
<entry><literal>zulu</literal></entry>
19972009
<entry>Military abbreviation for UTC</entry>
19982010
</row>
19992011
<row>
20002012
<entry><literal>z</literal></entry>
2001-
<entry>Short form of <literal>zulu</literal></entry>
2013+
<entry>Short form of <literal>zulu</literal> (also in ISO 8601)</entry>
20022014
</row>
20032015
</tbody>
20042016
</tgroup>
@@ -2336,6 +2348,24 @@ January 8 04:05:06 1999 PST
23362348
</tgroup>
23372349
</table>
23382350

2351+
<para>
2352+
In the <acronym>ISO</acronym> style, the time zone is always shown as
2353+
a signed numeric offset from UTC, with positive sign used for zones
2354+
east of Greenwich. The offset will be shown
2355+
as <replaceable>hh</replaceable> (hours only) if it is an integral
2356+
number of hours, else
2357+
as <replaceable>hh</replaceable>:<replaceable>mm</replaceable> if it
2358+
is an integral number of minutes, else as
2359+
<replaceable>hh</replaceable>:<replaceable>mm</replaceable>:<replaceable>ss</replaceable>.
2360+
(The third case is not possible with any modern time zone standard,
2361+
but it can appear when working with timestamps that predate the
2362+
adoption of standardized time zones.)
2363+
In the other date styles, the time zone is shown as an alphabetic
2364+
abbreviation if one is in common use in the current zone. Otherwise
2365+
it appears as a signed numeric offset in ISO 8601 basic format
2366+
(<replaceable>hh</replaceable> or <replaceable>hhmm</replaceable>).
2367+
</para>
2368+
23392369
<para>
23402370
The date/time style can be selected by the user using the
23412371
<command>SET datestyle</command> command, the <xref

0 commit comments

Comments
 (0)