David Fetter <[EMAIL PROTECTED]> writes:
> [code]

Seems pretty messy.  I believe the standard way of doing this is

regression=# create function epoch_to_timestamp(float8) returns timestamptz as '
regression'# begin
regression'#   return ''epoch''::timestamptz + $1 * ''1 second''::interval;
regression'# end' language plpgsql strict immutable;
CREATE FUNCTION

regression=# select now(), extract(epoch from now());
              now              |    date_part
-------------------------------+-----------------
 2003-08-16 08:43:16.925501-04 | 1061037796.9255
(1 row)

regression=# select epoch_to_timestamp(1061037796.9255);
     epoch_to_timestamp
-----------------------------
 2003-08-16 08:43:16.9255-04
(1 row)


                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to