Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitef20708

Browse files
committed
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.
1 parent1773e07 commitef20708

File tree

1 file changed

+52
-35
lines changed

1 file changed

+52
-35
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 52 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5270,11 +5270,11 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})');
52705270
</row>
52715271
<row>
52725272
<entry><literal>Y,YYY</literal></entry>
5273-
<entry>year (4and more digits) with comma</entry>
5273+
<entry>year (4or more digits) with comma</entry>
52745274
</row>
52755275
<row>
52765276
<entry><literal>YYYY</literal></entry>
5277-
<entry>year (4and more digits)</entry>
5277+
<entry>year (4or more digits)</entry>
52785278
</row>
52795279
<row>
52805280
<entry><literal>YYY</literal></entry>
@@ -5290,19 +5290,19 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})');
52905290
</row>
52915291
<row>
52925292
<entry><literal>IYYY</literal></entry>
5293-
<entry>ISO year (4and more digits)</entry>
5293+
<entry>ISO8601 week-numberingyear (4or more digits)</entry>
52945294
</row>
52955295
<row>
52965296
<entry><literal>IYY</literal></entry>
5297-
<entry>last 3 digits of ISO year</entry>
5297+
<entry>last 3 digits of ISO8601 week-numberingyear</entry>
52985298
</row>
52995299
<row>
53005300
<entry><literal>IY</literal></entry>
5301-
<entry>last 2 digits of ISO year</entry>
5301+
<entry>last 2 digits of ISO8601 week-numberingyear</entry>
53025302
</row>
53035303
<row>
53045304
<entry><literal>I</literal></entry>
5305-
<entry>last digit of ISO year</entry>
5305+
<entry>last digit of ISO8601 week-numberingyear</entry>
53065306
</row>
53075307
<row>
53085308
<entry><literal>BC</literal>, <literal>bc</literal>,
@@ -5372,35 +5372,35 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})');
53725372
</row>
53735373
<row>
53745374
<entry><literal>IDDD</literal></entry>
5375-
<entry>ISOday of year (001-371; day 1 of the year is Monday of the first ISO week.)</entry>
5375+
<entry>day ofISO 8601 week-numberingyear (001-371; day 1 of the year is Monday of the first ISO week)</entry>
53765376
</row>
53775377
<row>
53785378
<entry><literal>DD</literal></entry>
53795379
<entry>day of month (01-31)</entry>
53805380
</row>
53815381
<row>
53825382
<entry><literal>D</literal></entry>
5383-
<entry>day of the week, Sunday(<literal>1</>) to Saturday(<literal>7</>)</entry>
5383+
<entry>day of the week, Sunday(<literal>1</>) to Saturday(<literal>7</>)</entry>
53845384
</row>
53855385
<row>
53865386
<entry><literal>ID</literal></entry>
5387-
<entry>ISO day of the week, Monday(<literal>1</>) to Sunday(<literal>7</>)</entry>
5387+
<entry>ISO8601day of the week, Monday(<literal>1</>) to Sunday(<literal>7</>)</entry>
53885388
</row>
53895389
<row>
53905390
<entry><literal>W</literal></entry>
5391-
<entry>week of month (1-5) (The first week starts on the first day of the month.)</entry>
5391+
<entry>week of month (1-5) (the first week starts on the first day of the month)</entry>
53925392
</row>
53935393
<row>
53945394
<entry><literal>WW</literal></entry>
5395-
<entry>week number of year (1-53) (The first week starts on the first day of the year.)</entry>
5395+
<entry>week number of year (1-53) (the first week starts on the first day of the year)</entry>
53965396
</row>
53975397
<row>
53985398
<entry><literal>IW</literal></entry>
5399-
<entry>ISOweek number of year (01 -53; the first Thursday of thenewyear is in week 1.)</entry>
5399+
<entry>week number ofISO 8601 week-numberingyear (01-53; the first Thursday of the year is in week 1)</entry>
54005400
</row>
54015401
<row>
54025402
<entry><literal>CC</literal></entry>
5403-
<entry>century (2 digits) (The twenty-first century starts on 2001-01-01.)</entry>
5403+
<entry>century (2 digits) (the twenty-first century starts on 2001-01-01)</entry>
54045404
</row>
54055405
<row>
54065406
<entry><literal>J</literal></entry>
@@ -5571,16 +5571,16 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})');
55715571

55725572
<listitem>
55735573
<para>
5574-
An ISO week date (as distinct from a Gregorian date) can be
5575-
specified to <function>to_timestamp</function> and
5574+
An ISO8601week-numbering date (as distinct from a Gregorian date)
5575+
can bespecified to <function>to_timestamp</function> and
55765576
<function>to_date</function> in one of two ways:
55775577
<itemizedlist>
55785578
<listitem>
55795579
<para>
5580-
Year, week, and weekday: for example <literal>to_date('2006-42-4',
5581-
'IYYY-IW-ID')</literal> returns the date
5582-
<literal>2006-10-19</literal>. If you omit the weekday it
5583-
is assumed to be 1 (Monday).
5580+
Year, week number, and weekday: for
5581+
example <literal>to_date('2006-42-4', 'IYYY-IW-ID')</literal>
5582+
returns the date<literal>2006-10-19</literal>.
5583+
If you omit the weekday itis assumed to be 1 (Monday).
55845584
</para>
55855585
</listitem>
55865586
<listitem>
@@ -5592,13 +5592,25 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})');
55925592
</itemizedlist>
55935593
</para>
55945594
<para>
5595-
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.
56015601
</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>
56025614
</listitem>
56035615

56045616
<listitem>
@@ -6644,8 +6656,8 @@ SELECT EXTRACT(DECADE FROM TIMESTAMP '2001-02-16 20:38:40');
66446656
<term><literal>dow</literal></term>
66456657
<listitem>
66466658
<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</>)
66496661
</para>
66506662

66516663
<screen>
@@ -6725,8 +6737,8 @@ SELECT EXTRACT(HOUR FROM TIMESTAMP '2001-02-16 20:38:40');
67256737
<term><literal>isodow</literal></term>
67266738
<listitem>
67276739
<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</>)
67306742
</para>
67316743

67326744
<screen>
@@ -6745,7 +6757,8 @@ SELECT EXTRACT(ISODOW FROM TIMESTAMP '2001-02-18 20:38:40');
67456757
<term><literal>isoyear</literal></term>
67466758
<listitem>
67476759
<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)
67496762
</para>
67506763

67516764
<screen>
@@ -6756,7 +6769,11 @@ SELECT EXTRACT(ISOYEAR FROM DATE '2006-01-02');
67566769
</screen>
67576770

67586771
<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.
67606777
</para>
67616778
<para>
67626779
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');
69226939
<term><literal>week</literal></term>
69236940
<listitem>
69246941
<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
69276944
week of a year contains January 4 of that year. In other words, the
69286945
first Thursday of a year is in week 1 of that year.
69296946
</para>
69306947
<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
69336950
late-December dates to be part of the first week of the next year.
69346951
For example, <literal>2005-01-01</> is part of the 53rd week of year
69356952
2004, and <literal>2006-01-01</> is part of the 52nd week of year

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp