X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 320D1D1B4E1 for ; Fri, 7 Nov 2003 13:45:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 12905-06 for ; Fri, 7 Nov 2003 09:45:16 -0400 (AST) Received: from guinness.cs.stevens-tech.edu (guinness.cs.stevens-tech.edu [155.246.89.8]) by svr1.postgresql.org (Postfix) with ESMTP id 4E2ABD1B507 for ; Fri, 7 Nov 2003 09:45:13 -0400 (AST) Received: by guinness.cs.stevens-tech.edu (Postfix, from userid 4405) id 8C8A514187F; Fri, 7 Nov 2003 08:45:16 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by guinness.cs.stevens-tech.edu (Postfix) with ESMTP id 7E54FC2454; Fri, 7 Nov 2003 08:45:16 -0500 (EST) Date: Fri, 7 Nov 2003 08:45:16 -0500 From: Yasir Malik To: jinujosein@yahoo.com Cc: pgsql-sql@postgresql.org Subject: Re: DateDiff in PostgreSQL Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.2 tagged_above=0.0 required=5.0 tests=EMAIL_ATTRIBUTION, QUOTED_EMAIL_TEXT, RCVD_IN_RFCI, USER_AGENT_PINE X-Spam-Level: X-Archive-Number: 200311/39 X-Sequence-Number: 15854 Hi, You can use the age() function to find the difference between dates, and use the extract() function to get the years, months, days, etc. Yasir On Fri, 7 Nov 2003, George A.J wrote: > Date: Fri, 7 Nov 2003 05:34:09 -0800 (PST) > From: George A.J > To: pgsql-sql@postgresql.org > Subject: [SQL] DateDiff in PostgreSQL > > > Hi, > > i am converting a MSSQL Server database to PostgreSQL. > > Using PostgreSQL version 7.3.2. > > Is there any function like the DateDiff() in MSSQL Server. > > ie, a function that returns difference of two dates(timestamp) in days or months or year.. > > The - operator for timestamp retuns the intervel in days only. > > Please help > > jinujose > > > --------------------------------- > Do you Yahoo!? > Protect your identity with Yahoo! Mail AddressGuard