Re: Convert TimeStamp to Date

From: "shuai(at)objectwareinc(dot)com" <shuai(at)objectwareinc(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Convert TimeStamp to Date
Date: 2003-07-23 23:33:25
Message-ID: 23332581400063@UTIL.objectwareinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>Yep ... looks like it got broken in >7.3.
>7.2.4 works fine, but 7.3 (and CVS tip) >doesn't.

>This is because in 7.2, timestamp_date >() and timestamptz_date ()
do the
>same thing -
>convert the time to Julian date and >then subtruct the offset for
Y2K,
>and both work.

>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...

Thank you and everybody else. This explains it.

But still, is there a solution other than casting a timestamp to
timestamptz and then to date? Because I major concern is
performance.(and I probably can't change to another version) Thanks.

LS

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2003-07-24 00:00:33 Re: Role Models Wanted
Previous Message Cory 'G' Watson 2003-07-23 23:17:14 Re: Role Models Wanted