Re: Date differences

From: Devrim GUNDUZ <devrim(at)gunduz(dot)org>
To: Josué Maldonado <josue(at)lamundial(dot)hn>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Date differences
Date: 2004-04-05 23:12:55
Message-ID: Pine.LNX.4.44.0404060212340.1807-100000@emo.org.tr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----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(at)[local]:test=# SELECT age('05/12/2006','04/05/2004');
age
- ----------------------
2 years 1 mon 7 days

Regards,
- --
Devrim GUNDUZ
devrim(at)gunduz(dot)org devrim(dot)gunduz(at)linux(dot)org(dot)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-----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2004-04-06 00:00:07 Re: bug in 7.4.2, with Handling of Double Quotation Marks
Previous Message William White 2004-04-05 22:59:33 Re: left and overleft/notright revisited: why !>> and !<<