Thread: Timestamp with zero precision

Timestamp with zero precision

From
"Vilson farias"
Date:
Greetings,

  Is there a way to set a "timestamp compatibility mode" for PostgreSQL
7.3.3's timestamp with older versions of database (like 7.1.2)? I'd like to
set all timestamps to have precision = zero (hh:mm:ss only, without any
millisecond).

  I'm asking this because since I upgraded from 7.1.2 to 7.3.3 all my
aplications are raising lots and lots of errors due conversions from
timestamps to strings and it's gonna be very hard to fix all of them and I need to avoid database re-creation of database structures.

Thanks in advance.
 
--------------------------------------------------------------------------------
José Vilson de Mello de Farias
Software Engineer
 
Dígitro Tecnologia Ltda - www.digitro.com.br
APC - Customer Oriented Applications
E-mail: vilson.farias@digitro.com.br
Tel.: +55 48 281 7158
ICQ 11866179
 

Re: Timestamp with zero precision

From
"Shridhar Daithankar"
Date:
On 12 Aug 2003 at 11:02, Vilson farias wrote:
>  Is there a way to set a "timestamp compatibility mode" for PostgreSQL
> 7.3.3's timestamp with older versions of database (like 7.1.2)? I'd like to
> set all timestamps to have precision = zero (hh:mm:ss only, without any
> millisecond).
>
>  I'm asking this because since I upgraded from 7.1.2 to 7.3.3 all my
> aplications are raising lots and lots of errors due conversions from
> timestamps to strings and it's gonna be very hard to fix all of them and I need
> to avoid database re-creation of database structures.

Well a timestamp will always store a millisecond. It's just that it won't show
you.

May be you can create a view that will use date-time functions to select only
required part? Will that help you?

HTH

Bye
 Shridhar

--
Rules for driving in New York:    (1) Anything done while honking your horn is
legal.    (2) You may park anywhere if you turn your four-way flashers on.    (3) A
red light means the next six cars may go through the        intersection.


Re: Timestamp with zero precision

From
Tom Lane
Date:
"Vilson farias" <vilson.farias@digitro.com.br> writes:
>   Is there a way to set a "timestamp compatibility mode" for PostgreSQL
> 7.3.3's timestamp with older versions of database (like 7.1.2)? I'd like to
> set all timestamps to have precision =3D zero (hh:mm:ss only, without any
> millisecond).

Create the timestamp columns as
    timestamp(0) with time zone

            regards, tom lane