pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: email lists <lists@darrenmackay.com>
To: pgsql-sql@postgresql.org
Subject: Re: date_trunc for 5 minutes intervals
Date: Mon, 20 Oct 2003 09:27:32 +0100
Message-ID: <200310200927.32941.dev@archonet.com> (raw)
In-Reply-To: <035C9F7CE28601428BBB5B051C9F77F20766F4@orion.mackay.local>
References: <035C9F7CE28601428BBB5B051C9F77F20766F4@orion.mackay.local>

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



view thread (4+ messages)  latest in thread

Message-ID: <200310200927.32941.dev@archonet.com>
Permalink:  ../200310200927.32941.dev@archonet.com/
Also on:    postgresql.org/message-id/200310200927.32941.dev@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, lists@darrenmackay.com
  Subject: Re: date_trunc for 5 minutes intervals
  In-Reply-To: <200310200927.32941.dev@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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