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 constructs
like to_char(..., "IYYY-MM-DD") produce nonsensical results. Perhaps
hanging a few more adjectives on it will discourage them from jumping
to false conclusions. I put in an explicit warning against that
specific usage, too, though the main point is to discourage people
who haven't read this far down the page.
In passing fix some nearby markup and terminology inconsistencies.
Attempting to construct a date using a mixture of ISO week and
5610
-
Gregorian date fields is nonsensical, and will cause an error. In the
5611
-
context of an ISO year, the concept of a <quote>month</> or <quote>day
5612
-
of month</> has no meaning. In the context of a Gregorian year, the
5613
-
ISO week has no meaning. Users should avoid mixing Gregorian and
5614
-
ISO date specifications.
5609
+
Attempting to enter a date using a mixture of ISO 8601 week-numbering
5610
+
fields and Gregorian date fields is nonsensical, and will cause an
5611
+
error. In the context of an ISO 8601 week-numbering year, the
5612
+
concept of a <quote>month</> or <quote>day of month</> has no
5613
+
meaning. In the context of a Gregorian year, the ISO week has no
5614
+
meaning.
5615
5615
</para>
5616
+
<caution>
5617
+
<para>
5618
+
While <function>to_date</function> will reject a mixture of
5619
+
Gregorian and ISO week-numbering date
5620
+
fields, <function>to_char</function> will not, since output format
5621
+
specifications like <literal>YYYY-MM-DD (IYYY-IDDD)</> can be
5622
+
useful. But avoid writing something like <literal>IYYY-MM-DD</>;
5623
+
that would yield surprising results near the start of the year.
5624
+
(See <xref linkend="functions-datetime-extract"> for more
5625
+
information.)
5626
+
</para>
5627
+
</caution>
5616
5628
</listitem>
5617
5629
5618
5630
<listitem>
@@ -6658,8 +6670,8 @@ SELECT EXTRACT(DECADE FROM TIMESTAMP '2001-02-16 20:38:40');
6658
6670
<term><literal>dow</literal></term>
6659
6671
<listitem>
6660
6672
<para>
6661
-
The day of the week as Sunday(<literal>0</>) to
6662
-
Saturday(<literal>6</>)
6673
+
The day of the week as Sunday(<literal>0</>) to
6674
+
Saturday(<literal>6</>)
6663
6675
</para>
6664
6676
6665
6677
<screen>
@@ -6741,8 +6753,8 @@ SELECT EXTRACT(HOUR FROM TIMESTAMP '2001-02-16 20:38:40');
6741
6753
<term><literal>isodow</literal></term>
6742
6754
<listitem>
6743
6755
<para>
6744
-
The day of the week as Monday(<literal>1</>) to
6745
-
Sunday(<literal>7</>)
6756
+
The day of the week as Monday(<literal>1</>) to
6757
+
Sunday(<literal>7</>)
6746
6758
</para>
6747
6759
6748
6760
<screen>
@@ -6761,7 +6773,8 @@ SELECT EXTRACT(ISODOW FROM TIMESTAMP '2001-02-18 20:38:40');
6761
6773
<term><literal>isoyear</literal></term>
6762
6774
<listitem>
6763
6775
<para>
6764
-
The <acronym>ISO</acronym> 8601 year that the date falls in (not applicable to intervals)
6776
+
The <acronym>ISO</acronym> 8601 week-numbering year that the date
6777
+
falls in (not applicable to intervals)
6765
6778
</para>
6766
6779
6767
6780
<screen>
@@ -6772,7 +6785,11 @@ SELECT EXTRACT(ISOYEAR FROM DATE '2006-01-02');
6772
6785
</screen>
6773
6786
6774
6787
<para>
6775
-
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.
6788
+
Each <acronym>ISO</acronym> 8601 week-numbering year begins with the
6789
+
Monday of the week containing the 4th of January, so in early
6790
+
January or late December the <acronym>ISO</acronym> year may be
6791
+
different from the Gregorian year. See the <literal>week</literal>
6792
+
field for more information.
6776
6793
</para>
6777
6794
<para>
6778
6795
This field is not available in PostgreSQL releases prior to 8.3.
@@ -6938,14 +6955,14 @@ SELECT EXTRACT(SECOND FROM TIME '17:12:28.5');
6938
6955
<term><literal>week</literal></term>
6939
6956
<listitem>
6940
6957
<para>
6941
-
The number of the week of the year that the day is in. By definition
6942
-
(<acronym>ISO</acronym> 8601), weeks start on Mondays and the first
6958
+
The number of the <acronym>ISO</acronym> 8601 week-numbering week of
6959
+
the year. By definition, ISO weeks start on Mondays and the first
6943
6960
week of a year contains January 4 of that year. In other words, the
6944
6961
first Thursday of a year is in week 1 of that year.
6945
6962
</para>
6946
6963
<para>
6947
-
In the ISO definition, it is possible for early-January dates to be
6948
-
part of the 52nd or 53rd week of the previous year, and for
6964
+
In the ISO week-numbering system, it is possible for early-January
6965
+
dates to be part of the 52nd or 53rd week of the previous year, and for
6949
6966
late-December dates to be part of the first week of the next year.
6950
6967
For example, <literal>2005-01-01</> is part of the 53rd week of year
6951
6968
2004, and <literal>2006-01-01</> is part of the 52nd week of year
0 commit comments