Re: Conversion - Mailing list pgsql-sql

From Christopher Kings-Lynne
Subject Re: Conversion
Date
Msg-id GNELIHDDFBOCMGBFGEFOMEKKCDAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to Re: Conversion  ("Alexander M. Pravking" <fduch@antar.bryansk.ru>)
Responses Re: Conversion  ("Alexander M. Pravking" <fduch@antar.bryansk.ru>)
List pgsql-sql
> On Tue, Aug 13, 2002 at 11:32:25AM +0800, Christopher Kings-Lynne wrote:
> > Is the int4 a UNIX epoch? ie. seconds since 1970?
> >
> > If so, then this will generally work:
> >
> > SELECT CAST(int4field AS abstime);
> >
> > or
> >
> > SELECT int4field::abstime;
>
> http://www.postgresql.org/idocs/index.php?datatype-datetime.html says:
>
>  The types abstime  and reltime are lower precision types which are used
>  internally. You are discouraged from using any of these types in new
>  applications and are encouraged to move any old ones over when
>  appropriate. Any or all of these internal types might disappear in a
>  future release.

Yes, but in absence of:

SELECT EXTRACT(TIMESTAMP FROM EPOCH '12341234234');

(Hint Hint Thomas!!!)

It's all he can do.  I suggest using the syntax above to convert his integer
column to a timestamp column.

Chris



pgsql-sql by date:

Previous
From: "Alexander M. Pravking"
Date:
Subject: Re: Conversion
Next
From: "Sugandha Shah"
Date:
Subject: Re: Function error