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 889F0D1B4E1 for ; Fri, 7 Nov 2003 13:40:54 +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 13906-03 for ; Fri, 7 Nov 2003 09:40:25 -0400 (AST) Received: from heineken.cs.stevens-tech.edu (heineken.cs.stevens-tech.edu [155.246.89.69]) by svr1.postgresql.org (Postfix) with ESMTP id 19F17D1B4E4 for ; Fri, 7 Nov 2003 09:40:22 -0400 (AST) Received: from ymalik (helo=localhost) by heineken.cs.stevens-tech.edu with local-esmtp (Exim 3.35 #1 (Debian)) id 1AI6r6-0005NK-00; Fri, 07 Nov 2003 08:40:52 -0500 Date: Fri, 7 Nov 2003 08:40:52 -0500 (EST) From: Yasir Malik To: "George A.J" Cc: pgsql-sql@postgresql.org Subject: Re: DateDiff in PostgreSQL In-Reply-To: <20031107133409.25844.qmail@web14909.mail.yahoo.com> Message-ID: References: <20031107133409.25844.qmail@web14909.mail.yahoo.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/69 X-Sequence-Number: 15884 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