Re: age() vs. timestamp substraction

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Jean-Paul Argudo <jean-paul(at)argudo(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Martin Marques <martin(at)bugs(dot)unl(dot)edu(dot)ar>
Subject: Re: age() vs. timestamp substraction
Date: 2006-10-06 13:56:51
Message-ID: 20061006065548.A16785@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Graham Davis 2006-10-06 15:05:04 Re: [HACKERS] timestamp subtraction (was Re: formatting intervals
Previous Message Jean-Paul Argudo 2006-10-06 09:35:30 Re: age() vs. timestamp substraction