Thread: Date differences

Date differences

From
Josué Maldonado
Date:
Hello list,

Apologize me if this is so obvius. How can I know the difference in
years/months/days between 2 dates, for instance:

04/05/2004 - 05/12/2006, there are 2years/1month/7days.

Thanks in advance,


--
Josué Maldonado.
"Lo que un hombre desea, también lo imagina como cierto."


Re: Date differences

From
Devrim GUNDUZ
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

On Mon, 5 Apr 2004, [ISO-8859-1] Josué Maldonado wrote:

> Apologize me if this is so obvius. How can I know the difference in
> years/months/days between 2 dates, for instance:
>
> 04/05/2004 - 05/12/2006, there are 2years/1month/7days.

Use age() :

postgres@[local]:test=# SELECT age('05/12/2006','04/05/2004');
         age
- ----------------------
 2 years 1 mon 7 days

Regards,
- --
Devrim GUNDUZ
devrim@gunduz.org                devrim.gunduz@linux.org.tr
            http://www.TDMSoft.com
            http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFAcef4tl86P3SPfQ4RAlQvAKDYmzL3qWBoFEp6ASjMFBp+YdkGKgCcCzGN
UY6S2qCPiqaR+tQPo4a6gaY=
=M9rI
-----END PGP SIGNATURE-----