Обсуждение: Extract (week from date ) bug.

Поиск
Список
Период
Сортировка

Extract (week from date ) bug.

От
Ubold Hooper
Дата:
I think there must be a bug in the date calculations.
Consider the following query

select extract(week from date('2010-12-31')),  extract(week from date('2011=
-01-01')), extract(week from date('2011-01-03'))

Result:
date_part date_part date_part
52                     52               1


Why is extract(week from date('2011-01-01')) not identified as week 1?

-- Ubold Hooper
Amplify Insight| 55 Washington St. Brooklyn, NY. 11201|Tel: 347-474-4829|Em=
ail: uhooper@amplify.com<mailto:uhooper@amplify.com>

Re: Extract (week from date ) bug.

От
David Johnston
Дата:
Ubold Hooper wrote
> Why is extract(week from date('2011-01-01')) not identified as week 1?

Because "week" uses the ISO calendar and Week 1, 2011 begins on Monday,
January 3rd.

http://www.postgresql.org/docs/9.3/interactive/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT

David J.



--
View this message in context: http://postgresql.1045698.n5.nabble.com/Extract-week-from-date-bug-tp5776436p5776440.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.