From: | Emi Lu <emilu(at)encs(dot)concordia(dot)ca> |
---|---|
To: | "Oliveiros d'Azevedo Cristina" <oliveiros(dot)cristina(at)marktest(dot)pt> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Get days between two dates? |
Date: | 2011-01-31 16:36:45 |
Message-ID: | 4D46E51D.6050602@encs.concordia.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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" <emilu(at)encs(dot)concordia(dot)ca>
> To: <pgsql-sql(at)postgresql(dot)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(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-sql
--
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
emilu(at)encs(dot)concordia(dot)ca +1 514 848-2424 x5884
From | Date | Subject | |
---|---|---|---|
Next Message | Kenneth Marshall | 2011-01-31 16:39:27 | Re: Get days between two dates? |
Previous Message | Oliveiros d'Azevedo Cristina | 2011-01-31 16:33:58 | Re: Get days between two dates? |