How to convert an epoch to a timetamp?
Posted: Fri Oct 25, 2013 2:19 pm
Howdy,
On page 205 of the sql reference guide there is a little blurb about how to convert an epoch back into a timestamp:
Am I missing part of the equation?
On page 205 of the sql reference guide there is a little blurb about how to convert an epoch back into a timestamp:
However, that conversion doesn't seem to work:Here is how you can convert an epoch value back to a timestamp:
SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 982384720 * INTERVAL '1 second';
Code: Select all
dbadmin=> SELECT get_ahm_epoch(),
dbadmin-> get_ahm_time();
get_ahm_epoch | get_ahm_time
---------------+------------------------------------------------
4058 | Current AHM Time: 2013-10-24 12:00:01.57236-04
(1 row)
dbadmin=> SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 4058 * INTERVAL '1 second';
?column?
------------------------
1969-12-31 20:07:38-05
(1 row)