Date differences

Started by Josué Maldonadoabout 22 years ago2 messagesgeneral
Jump to latest
#1Josué Maldonado
josue@lamundial.hn

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."

#2Devrim GÜNDÜZ
devrim@gunduz.org
In reply to: Josué Maldonado (#1)
Re: Date differences

-----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-----