You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Docs: improve descriptions of ISO week-numbering date features.
Use the phraseology "ISO 8601 week-numbering year" in place of just"ISO year", and make related adjustments to other terminology.The point of this change is that it seems some people see "ISO year"and think "standard year", whereupon they're surprised when constructslike to_char(..., "IYYY-MM-DD") produce nonsensical results. Perhapshanging a few more adjectives on it will discourage them from jumpingto false conclusions. I put in an explicit warning against thatspecific usage, too, though the main point is to discourage peoplewho haven't read this far down the page.In passing fix some nearby markup and terminology inconsistencies.
Attempting toconstruct a date using a mixture of ISOweek and
5318
-
Gregorian date fields is nonsensical, and will cause an error. In the
5319
-
context of an ISO year, the concept of a <quote>month</> or <quote>day
5320
-
of month</>has no meaning. In the contextofa Gregorian year, the
5321
-
ISO week has no meaning. Users should avoid mixing Gregorian and
5322
-
ISO date specifications.
5317
+
Attempting toenter a date using a mixture of ISO8601 week-numbering
5318
+
fields andGregorian date fields is nonsensical, and will cause an
5319
+
error. In thecontext of an ISO8601 week-numberingyear, the
5320
+
conceptofa <quote>month</>or <quote>dayofmonth</> has no
5321
+
meaning. In the context of a Gregorian year, the ISO week has no
5322
+
meaning.
5323
5323
</para>
5324
+
<caution>
5325
+
<para>
5326
+
While <function>to_date</function> will reject a mixture of
5327
+
Gregorian and ISO week-numbering date
5328
+
fields, <function>to_char</function> will not, since output format
5329
+
specifications like <literal>YYYY-MM-DD (IYYY-IDDD)</> can be
5330
+
useful. But avoid writing something like <literal>IYYY-MM-DD</>;
5331
+
that would yield surprising results near the start of the year.
5332
+
(See <xref linkend="functions-datetime-extract"> for more
5333
+
information.)
5334
+
</para>
5335
+
</caution>
5324
5336
</listitem>
5325
5337
5326
5338
<listitem>
@@ -6324,8 +6336,8 @@ SELECT EXTRACT(DECADE FROM TIMESTAMP '2001-02-16 20:38:40');
6324
6336
<term><literal>dow</literal></term>
6325
6337
<listitem>
6326
6338
<para>
6327
-
The day of the week as Sunday(<literal>0</>) to
6328
-
Saturday(<literal>6</>)
6339
+
The day of the week as Sunday(<literal>0</>) to
6340
+
Saturday(<literal>6</>)
6329
6341
</para>
6330
6342
6331
6343
<screen>
@@ -6405,8 +6417,8 @@ SELECT EXTRACT(HOUR FROM TIMESTAMP '2001-02-16 20:38:40');
6405
6417
<term><literal>isodow</literal></term>
6406
6418
<listitem>
6407
6419
<para>
6408
-
The day of the week as Monday(<literal>1</>) to
6409
-
Sunday(<literal>7</>)
6420
+
The day of the week as Monday(<literal>1</>) to
6421
+
Sunday(<literal>7</>)
6410
6422
</para>
6411
6423
6412
6424
<screen>
@@ -6425,7 +6437,8 @@ SELECT EXTRACT(ISODOW FROM TIMESTAMP '2001-02-18 20:38:40');
6425
6437
<term><literal>isoyear</literal></term>
6426
6438
<listitem>
6427
6439
<para>
6428
-
The <acronym>ISO</acronym> 8601 year that the date falls in (not applicable to intervals)
6440
+
The <acronym>ISO</acronym> 8601 week-numbering year that the date
6441
+
falls in (not applicable to intervals)
6429
6442
</para>
6430
6443
6431
6444
<screen>
@@ -6436,7 +6449,11 @@ SELECT EXTRACT(ISOYEAR FROM DATE '2006-01-02');
6436
6449
</screen>
6437
6450
6438
6451
<para>
6439
-
Each <acronym>ISO</acronym> year begins with the Monday of the week containing the 4th of January, so in early January or late December the <acronym>ISO</acronym> year may be different from the Gregorian year. See the <literal>week</literal> field for more information.
6452
+
Each <acronym>ISO</acronym> 8601 week-numbering year begins with the
6453
+
Monday of the week containing the 4th of January, so in early
6454
+
January or late December the <acronym>ISO</acronym> year may be
6455
+
different from the Gregorian year. See the <literal>week</literal>
6456
+
field for more information.
6440
6457
</para>
6441
6458
<para>
6442
6459
This field is not available in PostgreSQL releases prior to 8.3.
@@ -6600,14 +6617,14 @@ SELECT EXTRACT(SECOND FROM TIME '17:12:28.5');
6600
6617
<term><literal>week</literal></term>
6601
6618
<listitem>
6602
6619
<para>
6603
-
The number of theweek of the year that the day is in. By definition
6604
-
(<acronym>ISO</acronym> 8601), weeks start on Mondays and the first
6620
+
The number of the<acronym>ISO</acronym> 8601 week-numbering week of
6621
+
the year. By definition, ISO weeks start on Mondays and the first
6605
6622
week of a year contains January 4 of that year. In other words, the
6606
6623
first Thursday of a year is in week 1 of that year.
6607
6624
</para>
6608
6625
<para>
6609
-
In the ISOdefinition, it is possible for early-January dates to be
6610
-
part of the 52nd or 53rd week of the previous year, and for
6626
+
In the ISOweek-numbering system, it is possible for early-January
6627
+
dates to bepart of the 52nd or 53rd week of the previous year, and for
6611
6628
late-December dates to be part of the first week of the next year.
6612
6629
For example, <literal>2005-01-01</> is part of the 53rd week of year
6613
6630
2004, and <literal>2006-01-01</> is part of the 52nd week of year