Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3931B475CEE for ; Thu, 16 Jan 2003 11:54:37 -0500 (EST) Received: from polaris.pinpointresearch.com (66-7-238-176.cust.telepacific.net [66.7.238.176]) by postgresql.org (Postfix) with ESMTP id A9A9D475BD7 for ; Thu, 16 Jan 2003 11:54:36 -0500 (EST) Received: from there (66-7-238-179.cust.telepacific.net [66.7.238.179]) by polaris.pinpointresearch.com (Postfix) with SMTP id BEC0C103DE; Thu, 16 Jan 2003 08:54:41 -0800 (PST) Content-Type: text/plain; charset="iso-8859-1" From: Steve Crawford Organization: Pinpoint Research To: "shreedhar" , "Postgres" Subject: Re: Is There any function to get Difference of Dates Date: Thu, 16 Jan 2003 08:54:42 -0800 X-Mailer: KMail [version 1.3.1] References: <00a201c2bd42$c10b4e30$1201a8c0@a4005> In-Reply-To: <00a201c2bd42$c10b4e30$1201a8c0@a4005> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <20030116165441.BEC0C103DE@polaris.pinpointresearch.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/171 X-Sequence-Number: 7013 Have you tried age(now(), tdate)? Or just: .....where now()-tdate < '2 days' Cheers, Steve On Thursday 16 January 2003 1:36 am, shreedhar wrote: > Hi All, > > Is There any function to get Difference of Dates. > > Here tdate is of type timestamp > > If I tried > > select * from temptbldate WHERE (EXTRACT(EPOCH FROM TIMESTAMP 'now()') - > EXTRACT(EPOCH FROM TIMESTAMP tdate) )/ 86400 < 2 > I got error as 'Parse error at tdate' > > select * from temptbldate WHERE (EXTRACT(EPOCH FROM TIMESTAMP 'now()') - > EXTRACT(EPOCH FROM TIMESTAMP 'tdate') )/ 86400 < 2 > If I use 'tdate', I got 'bad timestamp external representation 'tdate', > Probably it might be taking 'tdate' as string. > > How can I use epoch to get difference of two dates. > > Regards, > Sreedhar > > > "Faith, faith, faith in ourselves, faith, faith in God, this is the secret > of greatness. > If you have faith in all the three hundred and thirty millions of your > mythological gods, > and in all the gods which foreigners have now and again introduced into > your midst, > and still have no faith in yourselves, there is no salvation for you. " > (III. 190) > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org