Thread: # of 5 minute intervals in period of time ...

# of 5 minute intervals in period of time ...

From
"Marc G. Fournier"
Date:
Is there a simpler way of doing this then:

select (date_part('epoch', now()) -        date_part('epoch', now() - '30 days'::interval)) / ( 5 *  60 );

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: scrappy@hub.org           Yahoo!: yscrappy              ICQ: 7615664


Re: # of 5 minute intervals in period of time ...

From
Bruno Wolff III
Date:
On Tue, Dec 13, 2005 at 18:34:36 -0400, "Marc G. Fournier" <scrappy@postgresql.org> wrote:
> 
> Is there a simpler way of doing this then:
> 
> select (date_part('epoch', now()) -
>         date_part('epoch', now() - '30 days'::interval)) / ( 5 *  60 );

Are you trying to do this:
select extract(epoch from '30 days'::interval) / 300;

The above works in 8.0, but I don't know for sure what it does in 8.1.
Probably it just treats days as 24 hours, similar to how months are treated
as having 30 days.

> 
> ----
> Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
> Email: scrappy@hub.org           Yahoo!: yscrappy              ICQ: 7615664
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings