Re: Days betwen dates - Mailing list pgsql-novice

From Andy Holman
Subject Re: Days betwen dates
Date
Msg-id 3A5B9E45.95A8A84C@i-developit.com
Whole thread Raw
In response to Days betwen dates  (Andy Holman <info@i-developit.com>)
List pgsql-novice
Actually I found a fix for this (kinda)
There is a function named date_part. And
you can use something like

SELECT date_part('epoch', age('2001-01-24')) / 60 / 60 /24;

I believe that was what I used, and that gives you the days.
I am working from memory at the moment, but that is close.

--Andy

Stuart Urban wrote:
>
> I do not know if Postgres has the TO_DAYS() function, but I use that one
> in MySQL.  Try something like TO_DAYS(dateone) - TO_DAYS(now());  [don't
> know if the syntax is correct, but you can probably figure it out if you
> see whether the TO_DAYS() function exists].
>
> --Stu
>
> On Tue, 9 Jan 2001, Andy Holman
> wrote:
>
> > Anyone know how I can just get the number of
> > days between dates in 2 columns in a query?
> >
> > I am using something like age('dateone', 'now')
> > currently but that returns 1 year 10 mons 14 12:53:10
> > or something of the like. I just want the days between
> > them. I am using php. Please let me know if you have
> > any ideas.
> >
> > Thanks,
> > Andy
> >

pgsql-novice by date:

Previous
From: "Robert B. Easter"
Date:
Subject: Re: Comparison Operator problem
Next
From: Sandeep Joshi
Date:
Subject: delete trigger function in 'C'