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

Commit 8be950f

Browse files
committed
Document that we deviate from ISO 8601 by not using 'T' on output.
Per discussion, we should explain that we follow RFC 3339 and not really the letter of the ISO 8601 spec for timestamp output format. Mostly Brendan Jurd's wording, though I tweaked it to clarify that we do take 'T' on input. Minor additional copy-editing and markup-tweaking, too.
1 parent f1f6737 commit 8be950f

File tree

1 file changed

+29
-16
lines changed

1 file changed

+29
-16
lines changed

doc/src/sgml/datatype.sgml

+29-16
Original file line numberDiff line numberDiff line change
@@ -2206,37 +2206,46 @@ January 8 04:05:06 1999 PST
22062206
</thead>
22072207
<tbody>
22082208
<row>
2209-
<entry>ISO</entry>
2210-
<entry>ISO 8601/SQL standard</entry>
2211-
<entry>1997-12-17 07:37:16-08</entry>
2209+
<entry><literal>ISO</literal></entry>
2210+
<entry>ISO 8601, SQL standard</entry>
2211+
<entry><literal>1997-12-17 07:37:16-08</literal></entry>
22122212
</row>
22132213
<row>
2214-
<entry>SQL</entry>
2214+
<entry><literal>SQL</literal></entry>
22152215
<entry>traditional style</entry>
2216-
<entry>12/17/1997 07:37:16.00 PST</entry>
2216+
<entry><literal>12/17/1997 07:37:16.00 PST</literal></entry>
22172217
</row>
22182218
<row>
2219-
<entry>POSTGRES</entry>
2219+
<entry><literal>Postgres</literal></entry>
22202220
<entry>original style</entry>
2221-
<entry>Wed Dec 17 07:37:16 1997 PST</entry>
2221+
<entry><literal>Wed Dec 17 07:37:16 1997 PST</literal></entry>
22222222
</row>
22232223
<row>
2224-
<entry>German</entry>
2224+
<entry><literal>German</literal></entry>
22252225
<entry>regional style</entry>
2226-
<entry>17.12.1997 07:37:16.00 PST</entry>
2226+
<entry><literal>17.12.1997 07:37:16.00 PST</literal></entry>
22272227
</row>
22282228
</tbody>
22292229
</tgroup>
22302230
</table>
22312231

2232+
<note>
2233+
<para>
2234+
ISO 8601 specifies the use of uppercase letter <literal>T</> to separate
2235+
the date and time. <productname>PostgreSQL</> accepts that format on
2236+
input, but on output it uses a space rather than <literal>T</>, as shown
2237+
above. This is for readability and for consistency with RFC 3339 as
2238+
well as some other database systems.
2239+
</para>
2240+
</note>
2241+
22322242
<para>
22332243
In the <acronym>SQL</acronym> and POSTGRES styles, day appears before
22342244
month if DMY field ordering has been specified, otherwise month appears
22352245
before day.
22362246
(See <xref linkend="datatype-datetime-input">
22372247
for how this setting also affects interpretation of input values.)
2238-
<xref linkend="datatype-datetime-output2-table"> shows an
2239-
example.
2248+
<xref linkend="datatype-datetime-output2-table"> shows examples.
22402249
</para>
22412250

22422251
<table id="datatype-datetime-output2-table">
@@ -2253,29 +2262,33 @@ January 8 04:05:06 1999 PST
22532262
<row>
22542263
<entry><literal>SQL, DMY</></entry>
22552264
<entry><replaceable>day</replaceable>/<replaceable>month</replaceable>/<replaceable>year</replaceable></entry>
2256-
<entry>17/12/1997 15:37:16.00 CET</entry>
2265+
<entry><literal>17/12/1997 15:37:16.00 CET</literal></entry>
22572266
</row>
22582267
<row>
22592268
<entry><literal>SQL, MDY</></entry>
22602269
<entry><replaceable>month</replaceable>/<replaceable>day</replaceable>/<replaceable>year</replaceable></entry>
2261-
<entry>12/17/1997 07:37:16.00 PST</entry>
2270+
<entry><literal>12/17/1997 07:37:16.00 PST</literal></entry>
22622271
</row>
22632272
<row>
22642273
<entry><literal>Postgres, DMY</></entry>
22652274
<entry><replaceable>day</replaceable>/<replaceable>month</replaceable>/<replaceable>year</replaceable></entry>
2266-
<entry>Wed 17 Dec 07:37:16 1997 PST</entry>
2275+
<entry><literal>Wed 17 Dec 07:37:16 1997 PST</literal></entry>
22672276
</row>
22682277
</tbody>
22692278
</tgroup>
22702279
</table>
22712280

22722281
<para>
2273-
The date/time styles can be selected by the user using the
2282+
The date/time style can be selected by the user using the
22742283
<command>SET datestyle</command> command, the <xref
22752284
linkend="guc-datestyle"> parameter in the
22762285
<filename>postgresql.conf</filename> configuration file, or the
22772286
<envar>PGDATESTYLE</envar> environment variable on the server or
2278-
client. The formatting function <function>to_char</function>
2287+
client.
2288+
</para>
2289+
2290+
<para>
2291+
The formatting function <function>to_char</function>
22792292
(see <xref linkend="functions-formatting">) is also available as
22802293
a more flexible way to format date/time output.
22812294
</para>

0 commit comments

Comments
 (0)