Re: How to convert a UnixTimestamp to a PostgreSQL date without using ::abstime ? - Mailing list pgsql-general

From Tom Lane
Subject Re: How to convert a UnixTimestamp to a PostgreSQL date without using ::abstime ?
Date
Msg-id 26997.1063165265@sss.pgh.pa.us
Whole thread Raw
In response to How to convert a UnixTimestamp to a PostgreSQL date without using ::abstime ?  ("Bruno BAGUETTE" <pgsql-ml@baguette.net>)
Responses RE : How to convert a UnixTimestamp to a PostgreSQL date without using ::abstime ?  ("Bruno BAGUETTE" <pgsql-ml@baguette.net>)
RE : How to convert a UnixTimestamp to a PostgreSQL date without using ::abstime ?  ("Bruno BAGUETTE" <bouchon.web@baguette.net>)
List pgsql-general
"Bruno BAGUETTE" <pgsql-ml@baguette.net> writes:
> I'm looking for a way to convert a unix timestamp to a PostgreSQL date
> without using ::abstime which seems to be deprecated.

abstime is not yet deprecated in my mind, precisely because it's still
the easiest way to do the reverse of "extract(epoch from timestamp)".
The cleanest alternative I know of is

select 'epoch'::timestamptz + (unixtimestamphere) * '1 sec'::interval;

but this still leaves an unsatisfied feeling.  Sooner or later we'll
probably invent an explicit function to do this conversion.

            regards, tom lane

pgsql-general by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: Re: State of Beta 2
Next
From: Jan Wieck
Date:
Subject: Re: Replaceing records