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
5884
-
Gregorian date fields is nonsensical, and will cause an error. In the
5885
-
context of an ISO year, the concept of a <quote>month</> or <quote>day
5886
-
of month</> has no meaning. In the context of a Gregorian year, the
5887
-
ISO week has no meaning. Users should avoid mixing Gregorian and
5888
-
ISO date specifications.
5883
+
Attempting to enter a date using a mixture of ISO 8601 week-numbering
5884
+
fields and Gregorian date fields is nonsensical, and will cause an
5885
+
error. In the context of an ISO 8601 week-numbering year, the
5886
+
concept of a <quote>month</> or <quote>day of month</> has no
5887
+
meaning. In the context of a Gregorian year, the ISO week has no
5888
+
meaning.
5889
5889
</para>
5890
+
<caution>
5891
+
<para>
5892
+
While <function>to_date</function> will reject a mixture of
5893
+
Gregorian and ISO week-numbering date
5894
+
fields, <function>to_char</function> will not, since output format
5895
+
specifications like <literal>YYYY-MM-DD (IYYY-IDDD)</> can be
5896
+
useful. But avoid writing something like <literal>IYYY-MM-DD</>;
5897
+
that would yield surprising results near the start of the year.
5898
+
(See <xref linkend="functions-datetime-extract"> for more
5899
+
information.)
5900
+
</para>
5901
+
</caution>
5890
5902
</listitem>
5891
5903
5892
5904
<listitem>
@@ -7090,8 +7102,8 @@ SELECT EXTRACT(DECADE FROM TIMESTAMP '2001-02-16 20:38:40');
7090
7102
<term><literal>dow</literal></term>
7091
7103
<listitem>
7092
7104
<para>
7093
-
The day of the week as Sunday(<literal>0</>) to
7094
-
Saturday(<literal>6</>)
7105
+
The day of the week as Sunday(<literal>0</>) to
7106
+
Saturday(<literal>6</>)
7095
7107
</para>
7096
7108
7097
7109
<screen>
@@ -7173,8 +7185,8 @@ SELECT EXTRACT(HOUR FROM TIMESTAMP '2001-02-16 20:38:40');
7173
7185
<term><literal>isodow</literal></term>
7174
7186
<listitem>
7175
7187
<para>
7176
-
The day of the week as Monday(<literal>1</>) to
7177
-
Sunday(<literal>7</>)
7188
+
The day of the week as Monday(<literal>1</>) to
7189
+
Sunday(<literal>7</>)
7178
7190
</para>
7179
7191
7180
7192
<screen>
@@ -7193,7 +7205,8 @@ SELECT EXTRACT(ISODOW FROM TIMESTAMP '2001-02-18 20:38:40');
7193
7205
<term><literal>isoyear</literal></term>
7194
7206
<listitem>
7195
7207
<para>
7196
-
The <acronym>ISO</acronym> 8601 year that the date falls in (not applicable to intervals)
7208
+
The <acronym>ISO</acronym> 8601 week-numbering year that the date
7209
+
falls in (not applicable to intervals)
7197
7210
</para>
7198
7211
7199
7212
<screen>
@@ -7204,7 +7217,11 @@ SELECT EXTRACT(ISOYEAR FROM DATE '2006-01-02');
7204
7217
</screen>
7205
7218
7206
7219
<para>
7207
-
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.
7220
+
Each <acronym>ISO</acronym> 8601 week-numbering year begins with the
7221
+
Monday of the week containing the 4th of January, so in early
7222
+
January or late December the <acronym>ISO</acronym> year may be
7223
+
different from the Gregorian year. See the <literal>week</literal>
7224
+
field for more information.
7208
7225
</para>
7209
7226
<para>
7210
7227
This field is not available in PostgreSQL releases prior to 8.3.
@@ -7364,14 +7381,14 @@ SELECT EXTRACT(SECOND FROM TIME '17:12:28.5');
7364
7381
<term><literal>week</literal></term>
7365
7382
<listitem>
7366
7383
<para>
7367
-
The number of the week of the year that the day is in. By definition
7368
-
(<acronym>ISO</acronym> 8601), weeks start on Mondays and the first
7384
+
The number of the <acronym>ISO</acronym> 8601 week-numbering week of
7385
+
the year. By definition, ISO weeks start on Mondays and the first
7369
7386
week of a year contains January 4 of that year. In other words, the
7370
7387
first Thursday of a year is in week 1 of that year.
7371
7388
</para>
7372
7389
<para>
7373
-
In the ISO definition, it is possible for early-January dates to be
7374
-
part of the 52nd or 53rd week of the previous year, and for
7390
+
In the ISO week-numbering system, it is possible for early-January
7391
+
dates to be part of the 52nd or 53rd week of the previous year, and for
7375
7392
late-December dates to be part of the first week of the next year.
7376
7393
For example, <literal>2005-01-01</> is part of the 53rd week of year
7377
7394
2004, and <literal>2006-01-01</> is part of the 52nd week of year
0 commit comments