X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id E30399FA4D8 for ; Sun, 18 Jun 2006 12:28:51 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 89784-06 for ; Sun, 18 Jun 2006 12:28:48 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web31806.mail.mud.yahoo.com (web31806.mail.mud.yahoo.com [68.142.207.69]) by postgresql.org (Postfix) with SMTP id CBD019FA4A6 for ; Sun, 18 Jun 2006 12:28:47 -0300 (ADT) Received: (qmail 49960 invoked by uid 60001); 18 Jun 2006 15:28:46 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=BSpdWWJAzq3Il4VGt7BULQoF95sF3ExUuwi/jaAjNjlzslP4S4CjWerl3IrD3RaEEtSEf/FiFIEtX1Bf7wbzPzfmjwkpKewBD5RFCnylYNcUwDFeVZSkwI4ccf7LmeQIvktYDzXoLHlt1M53MPD1j5Fio8wDXtezh+5NyhCOikQ= ; Message-ID: <20060618152846.49958.qmail@web31806.mail.mud.yahoo.com> Received: from [68.235.218.116] by web31806.mail.mud.yahoo.com via HTTP; Sun, 18 Jun 2006 08:28:46 PDT Date: Sun, 18 Jun 2006 08:28:46 -0700 (PDT) From: Richard Broersma Jr Subject: Re: any additional date_time functions? To: Bruno Wolff III Cc: pgsql-sql@postgresql.org In-Reply-To: <20060618095450.GA29167@wolff.to> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/224 X-Sequence-Number: 25460 > > Are there any functions similar to date_trunc that can return variable increments i.e.: > > > > 5, 10, or 15 minutes increments, > > 3, 4, 6 hour increments, > > 1, 2 weekly increments, > You might be able to extract the time since the epoch and divide it by the > appropiate number of seconds (the length of your interval) and truncate > the result. This might have unexpected results for you when you span > daylight savings time changes. > > Another option is to not use timestamp, but rather just store an integer that > represents some number of your intervals offset from an epoch. Bruno, Thanks for the suggestions. I am going to "toy" around with them to see what I can get to work. Thanks for the help. Regards, Richard Broersma Jr.