Re: date time function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "John D(dot) Burger" <john(at)mitre(dot)org>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: date time function
Date: 2007-06-29 18:58:35
Message-ID: 7190.1183143515@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"John D. Burger" <john(at)mitre(dot)org> writes:
> Why do the first and third intervals print out differently?

The underlying storage is months, days, and seconds --- "1 year"
is the same as "12 months", but not the same as "365 days".
IIRC plain timestamp subtraction produces an interval with days and
seconds but the month part is always 0. You can use justify_days
to convert days to months (at an assumed 30 days/month). I'm not
sure exactly what age() does but it's probably producing a value
that has nonzero months to start with.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2007-06-29 19:06:28 Re: date time function
Previous Message Hannes Dorbath 2007-06-29 18:24:02 Re: db replication