From: | "Richard Huxton" <dev(at)archonet(dot)com> |
---|---|
To: | "Roberto Mello" <rmello(at)cc(dot)usu(dot)edu>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Converting epoch to timestamp? |
Date: | 2001-08-01 08:28:39 |
Message-ID: | 001b01c11a63$f86779e0$1001a8c0@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
From: "Roberto Mello" <rmello(at)cc(dot)usu(dot)edu>
Hi Roberto - long time no see.
> I searched the docs for function to convert epoch to timestamps but
> couldn't find any. Are there any?
richardh=> select now();
now
------------------------
2001-08-01 09:25:58+01
(1 row)
richardh=> select extract('epoch' from now());
date_part
-----------
996654359
(1 row)
richardh=> select '1970-01-01'::date + '996654342 seconds'::interval;
?column?
------------------------
2001-08-01 08:25:42+01
(1 row)
That's the only way I've ever known to do it. Note the one-hour offset
because I'm currently in BST rather than GMT timezone (ignore the few
seconds discrepancy - that's me querying then cutting and pasting).
Be interested to find out if there's a neater way. Can't believe there's not
some EPOCH_BASE constant that could be used.
- Richard Huxton
From | Date | Subject | |
---|---|---|---|
Next Message | Roberto Mello | 2001-08-01 13:29:29 | Re: Converting epoch to timestamp? |
Previous Message | Roberto Mello | 2001-08-01 06:57:08 | Converting epoch to timestamp? |