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 DD9923A5D37 for ; Wed, 26 Jan 2005 19:59:06 +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 51451-05 for ; Wed, 26 Jan 2005 19:59:00 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 9FA1E3A5CF3 for ; Wed, 26 Jan 2005 19:59:00 +0000 (GMT) Received: (qmail 24170 invoked by uid 500); 26 Jan 2005 20:13:19 -0000 Date: Wed, 26 Jan 2005 14:13:19 -0600 From: Bruno Wolff III To: Joel Fradkin Cc: pgsql-sql@postgresql.org Subject: Re: datediff is there something like it? Message-ID: <20050126201319.GA23744@wolff.to> Mail-Followup-To: Joel Fradkin , pgsql-sql@postgresql.org References: <000001c502f0$2d10a7c0$797ba8c0@jfradkin> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000001c502f0$2d10a7c0$797ba8c0@jfradkin> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/270 X-Sequence-Number: 20058 On Tue, Jan 25, 2005 at 10:11:40 -0500, Joel Fradkin wrote: > Hi all working my way through our views and all is going very well. > > We use datediff in MSSQL a bit and I read about the field1::date - > field2::date to return the days numerically. > > Is there any way to get months and years besides guessing days / 30 for > months etc? The age function will give a difference in years-months in addition to days-hours-minutes-seconds. Depending on what you want, it may not do exactly what you want.