From: Luis Sousa <llsousa@ualg.pt>
To: pgsql-sql@postgresql.org
Subject: Problem in age on a dates interval
Date: Fri, 16 Jul 2004 09:45:24 +0100
Message-ID: <40F795A4.5030206@ualg.pt> (raw)
Hi all,
I'm using PostgreSQL 7.3.3 on i386-pc-linux-gnu, compiled by GCC gcc
(GCC) 3.3 (Debian), and I don't understand the results of the following
queries:
SELECT age('2004-05-14 16:00'::timestamp,'2004-02-18 16:00'::timestamp);
age
----------------
2 mons 25 days
SELECT '2004-02-18 16:00'::timestamp+'2 mons 25 days'::interval;
?column?
---------------------
2004-05-13 16:00:00
In this case, the age from 2004-05-14 16:00 to 2004-02-18 16:00 is 2
mons 25 days, but if I add the age to the initial date, it returns one
day less!?
SELECT age('2004-05-26 16:00'::timestamp,'2004-02-18 16:00'::timestamp);
age
---------------
3 mons 8 days
SELECT '2004-02-18 16:00'::timestamp+'3 mons 8 days'::interval;
?column?
---------------------
2004-05-26 16:00:00
Here, the age between 2004-05-26 16:00 and 2004-02-18 16:00 is 3 mons 8
days, and this interval added to the initial date gives the correct result!!
Best regards,
Luis Sousa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: llsousa@ualg.pt
Subject: Re: Problem in age on a dates interval
In-Reply-To: <40F795A4.5030206@ualg.pt>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox