Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id D3B622E029C for ; Mon, 28 Jan 2008 00:51:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 07139-09 for ; Mon, 28 Jan 2008 00:50:58 -0400 (AST) Received: from outX.internet-mail-service.net (outX.internet-mail-service.net [216.240.47.247]) by postgresql.org (Postfix) with ESMTP id 3D97E2E018B for ; Mon, 28 Jan 2008 00:50:58 -0400 (AST) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.40) with ESMTP; Sun, 27 Jan 2008 20:50:57 -0800 X-Client-Authorized: MaGic Cook1e Received: from [192.168.1.109] (adsl-71-135-191-42.dsl.pltn13.pacbell.net [71.135.191.42]) by idiom.com (Postfix) with ESMTP id B0FAA127037 for ; Sun, 27 Jan 2008 20:50:56 -0800 (PST) Message-ID: <479D5F54.3040107@obviously.com> Date: Sun, 27 Jan 2008 20:51:32 -0800 From: Bryce Nesbitt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.11) Gecko/20070803 SUSE/1.1.7-0.1 SeaMonkey/1.1.7 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: extract or date_part on an interval? How many e References: <479D3E63.2080601@obviously.com> <16843.1201489840@sss.pgh.pa.us> In-Reply-To: <16843.1201489840@sss.pgh.pa.us> Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.818 tagged_above=0 required=5 tests=AWL=-0.641, BAYES_50=0.001, HTML_MESSAGE=0.001, MIME_HTML_ONLY=1.457 X-Spam-Level: X-Archive-Number: 200801/212 X-Sequence-Number: 30065 Sigh. Ok, I settled on:
select '1987-01-29'::timestamp + interval '21 years' > now();
Which is closer to what I wanted anyway (this was all about determining who was under 21 years old).  This at least should be robust over leap years.


Tom Lane wrote:
There is nothing simple about datetime calculations, ever :-(
  

-- 
----
Visit http://www.not-so-obviously.com/