convert epoch to date

Started by Kevin Kempterover 16 years ago2 messagesgeneral
Jump to latest
#1Kevin Kempter
kevink@consistentstate.com

Hi all;

I know how to convert a date to an epoch:

select extract ('epoch' from timestamp '2009-08-12')

How do I do the opposite, I want to convert epoch values to a date

Thanks in advance

#2Pavel Stehule
pavel.stehule@gmail.com
In reply to: Kevin Kempter (#1)
Re: convert epoch to date

Hello

2009/8/30 Kevin Kempter <kevink@consistentstate.com>:

Hi all;

I know how to convert a date to an epoch:

select extract ('epoch' from timestamp '2009-08-12')

postgres=# select extract ('epoch' from timestamp '2009-08-12');
date_part
------------
1250028000
(1 row)

Time: 0,734 ms
postgres=# select to_timestamp(1250028000);
to_timestamp
------------------------
2009-08-12 00:00:00+02
(1 row)

regards
Pavel Stehule

Show quoted text

How do I do the opposite, I want to convert epoch values to a date

Thanks in advance

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general