X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6247CDA879 for ; Wed, 26 Oct 2005 06:31:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17650-02 for ; Wed, 26 Oct 2005 09:31:41 +0000 (GMT) Received: from ucsns.ucs.co.za (ucsns.ucs.co.za [196.23.43.2]) by svr1.postgresql.org (Postfix) with ESMTP id 33999D803E for ; Wed, 26 Oct 2005 06:31:42 -0300 (ADT) Received: from ucspost.ucs.co.za (mailgw1.ucs.co.za [196.23.43.253]) by ucsns.ucs.co.za (Postfix) with ESMTP id 2BA2C2BD47; Wed, 26 Oct 2005 11:31:44 +0200 (SAST) Received: from jhb.ucs.co.za (jhb.ucs.co.za [172.31.1.3]) by ucspost.ucs.co.za (Postfix) with ESMTP id 37178D9DFF; Wed, 26 Oct 2005 11:31:43 +0200 (SAST) Received: from svb.ucs.co.za (svb.ucs.co.za [172.31.1.148]) by jhb.ucs.co.za (Postfix) with ESMTP id 0D46A97B06; Wed, 26 Oct 2005 11:31:43 +0200 (SAST) Date: Wed, 26 Oct 2005 11:31:42 +0200 From: Stef To: Rajesh Kumar Mallah Cc: pgsql-sql@postgresql.org Subject: Re: converting epoch to timestamp Message-ID: <20051026113142.25ec9045@svb.ucs.co.za> In-Reply-To: References: X-Mailer: Sylpheed-Claws 1.9.6cvs1 (GTK+ 2.6.10; i486-pc-linux-gnu) User-Agent: sillypheed-claws (anti-aliased) X-Face: +lU/o'$=Zv9%Xjo]Kq[_{n&Kb`f{YEWH4&Y#M]'6BkD?VoWe#*@S\MWyD'I>s:0v4{#\[J]l*?]t2uaO(j$d*77Ca-UHo.tkl2)0$B3Jxww\o:xor]<:*Yfx9Vceh)9I/'2g\RKhGTxIIsR^ke^`LVeZ9ksb*:$kQeR@ X-Operating-System: sid X-X-X: _-^-_ Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.12 required=5 tests=[AWL=0.120] X-Spam-Level: X-Archive-Number: 200510/317 X-Sequence-Number: 23170 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 ;