X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 28B3456774 for ; Mon, 21 Mar 2005 08:07:25 +0000 (GMT) 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 94690-07 for ; Mon, 21 Mar 2005 08:07:20 +0000 (GMT) Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by svr1.postgresql.org (Postfix) with ESMTP id 90AA856674 for ; Mon, 21 Mar 2005 08:07:19 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-31.mail.demon.net with esmtp (Exim 4.42) id 1DDHuN-000Oms-3j; Mon, 21 Mar 2005 08:05:07 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 870D816481; Mon, 21 Mar 2005 08:07:19 +0000 (GMT) Message-ID: <423E80B6.808@archonet.com> Date: Mon, 21 Mar 2005 08:07:18 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ashok.Agrawal@Sun.COM Cc: pgsql-sql@postgresql.org Subject: Re: date subtraction References: <4239CD55.305@Sun.COM> In-Reply-To: <4239CD55.305@Sun.COM> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.061 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200503/276 X-Sequence-Number: 20755 Ashok Agrawal wrote: > I need to do date calculation similar to oracle in postgres. > > like sysdate - creation_date of the record which returns no > of days in oracle which you can convert to hours or second > by multiplying by 60 or 3600. > > How do i achieve this in postgres. Umm, SELECT CURRENT_DATE - creation_date FROM my_table; -- Richard Huxton Archonet Ltd