From 9e9724e8bd5ffe8e32401bc15e8acfdef99bf9ed Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Fri, 1 Apr 2005 14:25:23 +0000 Subject: Fix wrong week returnded by date_trunc('week') for early dates in January --- would return wrong year for 2005-01-01 and 2006-01-01. per report from Robert Creager. Backpatch to 8.0.X. --- doc/src/sgml/func.sgml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'doc/src/sgml') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 4fee01c6d8c..f879664a9ee 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,5 +1,5 @@ @@ -5472,6 +5472,12 @@ SELECT EXTRACT(SECOND FROM TIME '17:12:28.5'); week starts on Monday.) In other words, the first Thursday of a year is in week 1 of that year. (for timestamp values only) + + 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, 2005-01-01 + is part of the 53rd week of year 2004, and 2006-01-01 is part of + the 52nd week of year 2005. + SELECT EXTRACT(WEEK FROM TIMESTAMP '2001-02-16 20:38:40'); -- cgit v1.2.3