By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,712 Members | 1,541 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,712 IT Pros & Developers. It's quick & easy.

Date differences

P: n/a
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."
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
-----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
de****@gunduz.org de***********@linux.org.tr
http://www.TDMSoft.com
http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFAcef4tl86P3SPfQ4RAlQvAKDYmzL3qWBoFEp6ASjMFB p+YdkGKgCcCzGN
UY6S2qCPiqaR+tQPo4a6gaY=
=M9rI
-----END PGP SIGNATURE-----
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.