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

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: # of 5 minute intervals in period of time ...
Date: 2005-12-14 19:13:57
Message-ID: 20051214191357.GA32563@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, Dec 13, 2005 at 18:34:36 -0400,
"Marc G. Fournier" <scrappy(at)postgresql(dot)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(at)hub(dot)org Yahoo!: yscrappy ICQ: 7615664
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Daniel Hertz 2005-12-15 00:46:12 Re: Multi-row update w. plpgsql function
Previous Message Keith Worthington 2005-12-14 18:22:16 Re: Defaulting a column to 'now'