Re: date_trunc for 5 minutes intervals

From: Richard Huxton <dev(at)archonet(dot)com>
To: email lists <lists(at)darrenmackay(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: date_trunc for 5 minutes intervals
Date: 2003-10-20 08:27:32
Message-ID: 200310200927.32941.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sunday 19 October 2003 14:38, email lists wrote:
> Hi All,
>
> I am wanting to perform the equivalent of date_trunc to 5/10/15 minute
> intervals. As this does mnot seem to be natively supported by
> date_trunc, can anyone point me in the right direction to possible write
> the SQL ro acheive the desired outcome?

I'd probably convert to seconds-since-epoch and then subtract that value
modulo 300 and convert back.

Might be worth checking the cookbook link on http://techdocs.postgresql.org/
since I can't believe you are the first person to need this.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Alvar Freude 2003-10-20 09:43:34 Re: [postgres] PostgreSQL-DB auf Web-Schnittstelle bringen
Previous Message Kumar 2003-10-20 06:28:27 Max input parameter for a function