Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: convert epoch to date


  • From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
  • To: Kevin Kempter <kevink(at)consistentstate(dot)com>
  • Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
  • Subject: Re: convert epoch to date
  • Date: Sun, 30 Aug 2009 22:36:45 +0200
  • Message-id: <162867790908301336y490978a2u823b70e1e8fcf379@mail.gmail.com> <text/plain>

Hello

2009/8/30 Kevin Kempter <kevink(at)consistentstate(dot)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

>
> 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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group