date question?

Started by KMillerover 25 years ago2 messagesgeneral
Jump to latest
#1KMiller
kmiller@2xtreme.net

Is there a way using the existing date/time functions to express any interval between two dates in days?

The output from age() is close but it breaks hte result out by year,month,day.

TIA, -km

#2Jim Mercer
jim@reptiles.org
In reply to: KMiller (#1)
Re: date question?

On Tue, Oct 31, 2000 at 06:08:18PM -0800, KMiller wrote:

Is there a way using the existing date/time functions to express any interval between two dates in days?

The output from age() is close but it breaks hte result out by year,month,day.

could try something like:

dbname=> select
date_part('epoch', age('1999-01-01', '1999-02-01'))
/ 60 / 60 / 24;
?column?
--------
-30
(1 row)

--
[ Jim Mercer jim@reptiles.org +1 416 410-5633 ]
[ Reptilian Research -- Longer Life through Colder Blood ]
[ Don't be fooled by cheap Finnish imitations; BSD is the One True Code. ]