Thread: date_trunc('week', '2005-01-01'::TIMESTAMP)

date_trunc('week', '2005-01-01'::TIMESTAMP)

From
"pgsql-general@list.coretech.ro"
Date:
select date_trunc('week', '2005-01-01'::TIMESTAMP) returns '2006-01-02
00:00:00'

is this the intended result or is some kind of a bug ?
the result should not be '2004-12-27 00:00:00' ?

thanks,
Razvan Radu



Re: date_trunc('week', '2005-01-01'::TIMESTAMP)

From
"A. Kretschmer"
Date:
am  22.09.2005, um 12:40:00 +0300 mailte pgsql-general@list.coretech.ro folgendes:
>
> select date_trunc('week', '2005-01-01'::TIMESTAMP) returns '2006-01-02
> 00:00:00'

Which version?

test=# select date_trunc('week', '2005-01-01'::TIMESTAMP);
     date_trunc
---------------------
 2004-12-27 00:00:00
(1 row)

test=# select version();
                                          version
-------------------------------------------------------------------------------------------
 PostgreSQL 8.0.3 on i386-pc-linux-gnu, compiled by GCC cc (GCC) 3.3.5 (Debian 1:3.3.5-13)
(1 row)



The result is IMHO correct.


Regards, Andreas
--
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47212,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    ===

Re: date_trunc('week', '2005-01-01'::TIMESTAMP)

From
Michael Fuhr
Date:
On Thu, Sep 22, 2005 at 12:20:58PM +0200, A. Kretschmer wrote:
> am  22.09.2005, um 12:40:00 +0300 mailte pgsql-general@list.coretech.ro folgendes:
> > select date_trunc('week', '2005-01-01'::TIMESTAMP) returns '2006-01-02
> > 00:00:00'
>
> Which version?

This bug was fixed in 8.0.2:

http://archives.postgresql.org/pgsql-committers/2005-04/msg00008.php

A similar bug is fixed in CVS, so it'll be in 8.0.4:

http://archives.postgresql.org/pgsql-committers/2005-07/msg00144.php

--
Michael Fuhr