BUG #1749: date_trunc('week', ...) is incorrect for some dates

Started by Nick Johnsonalmost 21 years ago2 messagesbugs
Jump to latest
#1Nick Johnson
arachnid@notdot.net

The following bug has been logged online:

Bug reference: 1749
Logged by: Nick Johnson
Email address: arachnid@notdot.net
PostgreSQL version: 8.0.3
Operating system: FreeBSD
Description: date_trunc('week', ...) is incorrect for some dates
Details:

numa=# SELECT date_trunc('week', '2002-12-31'::date);
date_trunc
------------------------
2001-12-31 00:00:00-05
(1 row)

Obviously this isn't the expected behaviour...

#2Bruce Momjian
bruce@momjian.us
In reply to: Nick Johnson (#1)
Re: [BUGS] BUG #1749: date_trunc('week', ...) is incorrect for some

Nick Johnson wrote:

The following bug has been logged online:

Bug reference: 1749
Logged by: Nick Johnson
Email address: arachnid@notdot.net
PostgreSQL version: 8.0.3
Operating system: FreeBSD
Description: date_trunc('week', ...) is incorrect for some dates
Details:

numa=# SELECT date_trunc('week', '2002-12-31'::date);
date_trunc
------------------------
2001-12-31 00:00:00-05
(1 row)

Obviously this isn't the expected behaviour...

Thanks, patch attached and applied to CVS HEAD and 8.0.X. When we fixed
January dates that were part of the previous year, I thought their might
be December dates in the next year, but I couldn't find any so I figured
they didn't exist.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/bjm/difftext/plainDownload+6-0