Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 8D69D9FB3CB for ; Thu, 14 Jun 2007 04:00:33 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 86693-10 for ; Thu, 14 Jun 2007 04:00:14 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.235]) by postgresql.org (Postfix) with ESMTP id 699379FB546 for ; Thu, 14 Jun 2007 04:00:14 -0300 (ADT) Received: by wr-out-0506.google.com with SMTP id 68so391444wri for ; Thu, 14 Jun 2007 00:00:13 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=s0vs9x8vRfpv3m7uLq6FhChIr+1jHozgKQOwJ2e0z6iXXqQ5btjki/1howOs13I0SvOGCdgz0cXRbfOhCYhV/aK5gV/1hfm8FWhEInoNk1FKqUvFC9wcYMgfNf57RvcPnCQtp7rlS3B5EeMdc7XwBpeDy0HAFNKGufQckOnI+Ng= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=W6o1OBVfNAqhQUv/d4oHfYayvhyR3kF2Hgo3H/XDH9ejK1iVAythr7V7edZaar83OTcxImX+lbChnUyQTXP8SghhYS5IyEe4SeL8KLmYPER1F+4J/N+mlzpB419/sjyDOTFqZ1zC5e8pfL4CVkvXZN3GokXdwoGkT+k52vw4BJ0= Received: by 10.143.160.1 with SMTP id m1mr78718wfo.1181804412822; Thu, 14 Jun 2007 00:00:12 -0700 (PDT) Received: by 10.142.80.10 with HTTP; Thu, 14 Jun 2007 00:00:12 -0700 (PDT) Message-ID: <162867790706140000w478d4bds4a0a2f42a8666a26@mail.gmail.com> Date: Thu, 14 Jun 2007 09:00:12 +0200 From: "Pavel Stehule" To: "Ashish Karalkar" Subject: Re: [SQL] function to find difference between in days between two dates Cc: pgsql-general@postgresql.org, pgsql-sql@postgresql.org In-Reply-To: <006101c7ae4c$ed7edbd0$170211ac@LIONKING.COM> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <006101c7ae4c$ed7edbd0$170211ac@LIONKING.COM> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/830 X-Sequence-Number: 115653 Hello PostgreSQL hasn't any official function for it. If you need it, you can write own function CREATE FUNCTION date_diff(date, date) returns integer as $$ select $1-$2; $$ language sql; Regards Pavel Stehule 2007/6/14, Ashish Karalkar : > > > Hello all, > > Is there any function to find differences in days between two dates? > > > I am using > > select abs(current_date - '2007-06-15') > > to get the desired result. > but I think there must be a function and I am missing it, > if so, can anybody please point me to that. > > > Thanks in advance > > With regards > Ashish Karalkar > > >