Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] Convert TimeStamp to Date

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dmitry Tkach <dmitry(at)openratings(dot)com>
Cc: Claudio Lapidus <clapidus(at)hotmail(dot)com>,pgsql-general(at)postgresql(dot)org, Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>,shuai(at)objectwareinc(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: [GENERAL] Convert TimeStamp to Date
Date: 2003-07-24 00:31:15
Message-ID: 13744.1059006675@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-general
Dmitry Tkach <dmitry(at)openratings(dot)com> writes:
> In 7.3 (and 7.4) timestamptz_date () is still doing that (and select 
> '1999-12-31 00:00:01'::timestamptz::date still works),
> *but* timestamp_date() is changed for some reason to just divide the 
> timestamp by the number of microseconds per day, that is obviously wrong 
> for the case when ts is negative (before 2000) because integer division 
> (unlike floor ())  truncates towards zero...

Good catch.  It looks like Tom Lockhart changed this routine when he was
adding the int64-timestamp option.  He probably had a momentary brain
fade about the direction of rounding needed :-(

I've changed it back to doing things the 7.2 way in CVS tip.  This will
be in 7.3.4 unless Marc already wrapped the tarball, which I don't think
he did.

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Bruce MomjianDate: 2003-07-24 02:29:21
Subject: Re: Small problem in contrib/dbase/dbf2pg.c
Previous:From: Dmitry TkachDate: 2003-07-23 22:36:34
Subject: Re: Convert TimeStamp to Date

pgsql-general by date

Next:From: Jean-Christian ImbeaultDate: 2003-07-24 02:43:48
Subject: SAP DB: The unsung Open Source DB
Previous:From: Karsten HilbertDate: 2003-07-24 00:00:33
Subject: Re: Role Models Wanted

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group