Re: # of 5 minute intervals in period of time ... - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: # of 5 minute intervals in period of time ...
Date
Msg-id 20051214191357.GA32563@wolff.to
Whole thread Raw
In response to # of 5 minute intervals in period of time ...  ("Marc G. Fournier" <scrappy@postgresql.org>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: "Keith Worthington"
Date:
Subject: Re: Defaulting a column to 'now'
Next
From: Daniel Hertz
Date:
Subject: Re: Multi-row update w. plpgsql function