diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2013-03-18 13:34:15 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2013-03-18 13:34:15 -0400 |
commit | e39feb1006ac5c64fd804597088bc7f40ff7b635 (patch) | |
tree | bccc70d86505fa1759a09c067b336e88ed459ecc | |
parent | e016b72411caa7027f9c980fb2c0560cdab2a129 (diff) | |
download | postgresql-e39feb1006ac5c64fd804597088bc7f40ff7b635.tar.gz postgresql-e39feb1006ac5c64fd804597088bc7f40ff7b635.zip |
Improve documentation of EXTRACT(WEEK).
The docs showed that early-January dates can be considered part of the
previous year for week-counting purposes, but failed to say explicitly
that late-December dates can also be considered part of the next year.
Fix that, and add a cross-reference to the "isoyear" field. Per bug
#7967 from Pawel Kobylak.
-rw-r--r-- | doc/src/sgml/func.sgml | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 896c08c09cf..51df17248a5 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -7151,16 +7151,19 @@ SELECT EXTRACT(SECOND FROM TIME '17:12:28.5'); <listitem> <para> The number of the week of the year that the day is in. By definition - (<acronym>ISO</acronym> 8601), the first week of a year - contains January 4 of that year. (The <acronym>ISO</acronym>-8601 - week starts on Monday.) In other words, the first Thursday of - a year is in week 1 of that year. + (<acronym>ISO</acronym> 8601), weeks start on Mondays and the first + week of a year contains January 4 of that year. In other words, the + first Thursday of a year is in week 1 of that year. </para> <para> - Because of this, it is possible for early January dates to be part of the - 52nd or 53rd week of the previous year. For example, <literal>2005-01-01</> - is part of the 53rd week of year 2004, and <literal>2006-01-01</> is part of - the 52nd week of year 2005. + In the ISO definition, it is possible for early-January dates to be + part of the 52nd or 53rd week of the previous year, and for + late-December dates to be part of the first week of the next year. + For example, <literal>2005-01-01</> is part of the 53rd week of year + 2004, and <literal>2006-01-01</> is part of the 52nd week of year + 2005, while <literal>2012-12-31</> is part of the first week of 2013. + It's recommended to use the <literal>isoyear</> field together with + <literal>week</> to get consistent results. </para> <screen> |