pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
# of 5 minute intervals in period of time ...
2+ messages / 2 participants
[nested] [flat]

* # of 5 minute intervals in period of time ...
@ 2005-12-13 22:34 Marc G. Fournier <scrappy@postgresql.org>
  2005-12-14 19:13 ` Re: # of 5 minute intervals in period of time ... Bruno Wolff III <bruno@wolff.to>
  0 siblings, 1 reply; 2+ messages in thread

From: Marc G. Fournier @ 2005-12-13 22:34 UTC (permalink / raw)
  To: pgsql-sql


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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: # of 5 minute intervals in period of time ...
  2005-12-13 22:34 # of 5 minute intervals in period of time ... Marc G. Fournier <scrappy@postgresql.org>
@ 2005-12-14 19:13 ` Bruno Wolff III <bruno@wolff.to>
  0 siblings, 0 replies; 2+ messages in thread

From: Bruno Wolff III @ 2005-12-14 19:13 UTC (permalink / raw)
  To: Marc G. Fournier <scrappy@postgresql.org>; +Cc: 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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-12-14 19:13 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-12-13 22:34 # of 5 minute intervals in period of time ... Marc G. Fournier <scrappy@postgresql.org>
2005-12-14 19:13 ` Bruno Wolff III <bruno@wolff.to>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox