Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 201729FA4D9 for ; Fri, 6 Oct 2006 10:57:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 89639-04 for ; Fri, 6 Oct 2006 13:56:58 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by postgresql.org (Postfix) with ESMTP id D58529F9EB3 for ; Fri, 6 Oct 2006 10:56:57 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id D618735354; Fri, 6 Oct 2006 06:56:51 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id D411E35352; Fri, 6 Oct 2006 06:56:51 -0700 (PDT) Date: Fri, 6 Oct 2006 06:56:51 -0700 (PDT) From: Stephan Szabo To: Jean-Paul Argudo Cc: pgsql-sql@postgresql.org, Tom Lane , Martin Marques Subject: Re: age() vs. timestamp substraction In-Reply-To: <45262362.4030101@argudo.org> Message-ID: <20061006065548.A16785@megazone.bigpanda.com> References: <29752.1160073444@sss.pgh.pa.us> <45262362.4030101@argudo.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200610/78 X-Sequence-Number: 26467 On Fri, 6 Oct 2006, Jean-Paul Argudo wrote: > Hi all, > > > Where did you get that idea? age's reference point is current_date (ie, > > midnight) not now(). There are also some differences in the calculation > > compared to a plain timestamp subtraction. > > I'm jumping on this thread to point out a little strange thing to me. > CURRENT_DATE, converted (stupidly) as a string *with* hour is "current > date at mid-day": > > > test=# select to_char(current_date,'YYYY-MM-DD HH:MI:SS'); > to_char > --------------------- > 2006-10-06 12:00:00 > (1 ligne) > > It was a day when I had to debug a strange behaviour in a customer's > (bad) code :-) That's both midnight and mid-day. It's asking for 12 hour time and no AM/PM marker.