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
5596
-
Gregorian date fields is nonsensical, and will cause an error. In the
5597
-
context of an ISO year, the concept of a <quote>month</> or <quote>day
5598
-
of month</>has no meaning. In the contextofa Gregorian year, the
5599
-
ISO week has no meaning. Users should avoid mixing Gregorian and
5600
-
ISO date specifications.
5595
+
Attempting toenter a date using a mixture of ISO8601 week-numbering
5596
+
fields andGregorian date fields is nonsensical, and will cause an
5597
+
error. In thecontext of an ISO8601 week-numberingyear, the
5598
+
conceptofa <quote>month</>or <quote>dayofmonth</> has no
5599
+
meaning. In the context of a Gregorian year, the ISO week has no
5600
+
meaning.
5601
5601
</para>
5602
+
<caution>
5603
+
<para>
5604
+
While <function>to_date</function> will reject a mixture of
5605
+
Gregorian and ISO week-numbering date
5606
+
fields, <function>to_char</function> will not, since output format
5607
+
specifications like <literal>YYYY-MM-DD (IYYY-IDDD)</> can be
5608
+
useful. But avoid writing something like <literal>IYYY-MM-DD</>;
5609
+
that would yield surprising results near the start of the year.
5610
+
(See <xref linkend="functions-datetime-extract"> for more
5611
+
information.)
5612
+
</para>
5613
+
</caution>
5602
5614
</listitem>
5603
5615
5604
5616
<listitem>
@@ -6644,8 +6656,8 @@ SELECT EXTRACT(DECADE FROM TIMESTAMP '2001-02-16 20:38:40');
6644
6656
<term><literal>dow</literal></term>
6645
6657
<listitem>
6646
6658
<para>
6647
-
The day of the week as Sunday(<literal>0</>) to
6648
-
Saturday(<literal>6</>)
6659
+
The day of the week as Sunday(<literal>0</>) to
6660
+
Saturday(<literal>6</>)
6649
6661
</para>
6650
6662
6651
6663
<screen>
@@ -6725,8 +6737,8 @@ SELECT EXTRACT(HOUR FROM TIMESTAMP '2001-02-16 20:38:40');
6725
6737
<term><literal>isodow</literal></term>
6726
6738
<listitem>
6727
6739
<para>
6728
-
The day of the week as Monday(<literal>1</>) to
6729
-
Sunday(<literal>7</>)
6740
+
The day of the week as Monday(<literal>1</>) to
6741
+
Sunday(<literal>7</>)
6730
6742
</para>
6731
6743
6732
6744
<screen>
@@ -6745,7 +6757,8 @@ SELECT EXTRACT(ISODOW FROM TIMESTAMP '2001-02-18 20:38:40');
6745
6757
<term><literal>isoyear</literal></term>
6746
6758
<listitem>
6747
6759
<para>
6748
-
The <acronym>ISO</acronym> 8601 year that the date falls in (not applicable to intervals)
6760
+
The <acronym>ISO</acronym> 8601 week-numbering year that the date
6761
+
falls in (not applicable to intervals)
6749
6762
</para>
6750
6763
6751
6764
<screen>
@@ -6756,7 +6769,11 @@ SELECT EXTRACT(ISOYEAR FROM DATE '2006-01-02');
6756
6769
</screen>
6757
6770
6758
6771
<para>
6759
-
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.
6772
+
Each <acronym>ISO</acronym> 8601 week-numbering year begins with the
6773
+
Monday of the week containing the 4th of January, so in early
6774
+
January or late December the <acronym>ISO</acronym> year may be
6775
+
different from the Gregorian year. See the <literal>week</literal>
6776
+
field for more information.
6760
6777
</para>
6761
6778
<para>
6762
6779
This field is not available in PostgreSQL releases prior to 8.3.
@@ -6922,14 +6939,14 @@ SELECT EXTRACT(SECOND FROM TIME '17:12:28.5');
6922
6939
<term><literal>week</literal></term>
6923
6940
<listitem>
6924
6941
<para>
6925
-
The number of theweek of the year that the day is in. By definition
6926
-
(<acronym>ISO</acronym> 8601), weeks start on Mondays and the first
6942
+
The number of the<acronym>ISO</acronym> 8601 week-numbering week of
6943
+
the year. By definition, ISO weeks start on Mondays and the first
6927
6944
week of a year contains January 4 of that year. In other words, the
6928
6945
first Thursday of a year is in week 1 of that year.
6929
6946
</para>
6930
6947
<para>
6931
-
In the ISOdefinition, it is possible for early-January dates to be
6932
-
part of the 52nd or 53rd week of the previous year, and for
6948
+
In the ISOweek-numbering system, it is possible for early-January
6949
+
dates to bepart of the 52nd or 53rd week of the previous year, and for
6933
6950
late-December dates to be part of the first week of the next year.
6934
6951
For example, <literal>2005-01-01</> is part of the 53rd week of year
6935
6952
2004, and <literal>2006-01-01</> is part of the 52nd week of year