pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Extract (week from date ) bug.
2+ messages / 2 participants
[nested] [flat]

* Extract (week from date ) bug.
@ 2013-10-30 19:46 Ubold Hooper <uhooper@amplify.com>
  2013-10-30 20:43 ` Re: Extract (week from date ) bug. David Johnston <polobo@yahoo.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Ubold Hooper @ 2013-10-30 19:46 UTC (permalink / raw)
  To: pgsql-bugs

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|Email: uhooper@amplify.com<mailto:uhooper@amplify.com>

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Extract (week from date ) bug.
  2013-10-30 19:46 Extract (week from date ) bug. Ubold Hooper <uhooper@amplify.com>
@ 2013-10-30 20:43 ` David Johnston <polobo@yahoo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: David Johnston @ 2013-10-30 20:43 UTC (permalink / raw)
  To: pgsql-bugs

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.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2013-10-30 20:43 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-10-30 19:46 Extract (week from date ) bug. Ubold Hooper <uhooper@amplify.com>
2013-10-30 20:43 ` David Johnston <polobo@yahoo.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox