On 01/31/2011 11:33 AM, Oliveiros d'Azevedo Cristina wrote:
Doesn't the SELECT you indicated do what you need?
Ok, I figured out:
age() + date_part(...) would be able to get it:
select date_part('day', age(date1::timestamp, date2::timestamp) )
--
Lu Ying
----- Original Message ----- From: "Emi Lu" <em...@encs.concordia.ca>
To: <pgsql-sql@postgresql.org>
Sent: Monday, January 31, 2011 3:50 PM
Subject: [SQL] Get days between two dates?
Good morning,
Is there an existing method to get days between two dates?
For example,
select '2010-01-01'::date - '1999-10-12'::date
Returns how many days.
Thank you,
--
Lu Ying
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
--
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
em...@encs.concordia.ca +1 514 848-2424 x5884
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql