Re: converting epoch to timestamp

From: Stef <svb(at)ucs(dot)co(dot)za>
To: Rajesh Kumar Mallah <mallah(dot)rajesh(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: converting epoch to timestamp
Date: 2005-10-26 09:31:42
Message-ID: 20051026113142.25ec9045@svb.ucs.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Rajesh Kumar Mallah mentioned :
=> Can anyone tell me how to convert epoch to timestamp ?
=>
=> ie reverse of :
=>
=> SELECT EXTRACT( epoch FROM now() );
=> +------------------+
=> | date_part |
=> +------------------+
=> | 1130317518.61997 |
=> +------------------+

Here is one way (In my case I still had to add/subtract timezone diff)
select '19700101'::timestamp + foo.epoch::interval from (select extract(epoch from now())||' seconds' as epoch) foo ;

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Marc G. Fournier 2005-10-26 09:48:41 Re: pl/* overhead ...
Previous Message A. Kretschmer 2005-10-26 09:25:16 Re: converting epoch to timestamp