Re: timestamp interval issue

From: "Lonni J Friedman" <netllama(at)gmail(dot)com>
To: "Michael Glaesemann" <grzm(at)seespotcode(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: timestamp interval issue
Date: 2007-10-05 23:46:37
Message-ID: 7c1574a90710051646n78c75e43rd601c56305812eff@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 10/5/07, Michael Glaesemann <grzm(at)seespotcode(dot)net> wrote:
>
> On Oct 5, 2007, at 17:47 , Lonni J Friedman wrote:
>
> > I need a means of returning only the rows which have a
> > timestamp that falls after the last 16:00 and before the next 16:00
> > (on the clock), regardless of date.
>
> Would something like this work for you?
>
> select *
> from footable0
> where case when current_time < '16:00'::time
> then date_created between (current_date - 1) + interval
> '16 hours'
> and current_date + interval '16 hours'
> else date_created between current_date + interval '16 hours'
> and (current_date + 1) + interval '16
> hours';
>
> I'm not sure if I'm interpreting what you need properly, but I think
> this does what you want.

Thanks. I gave this a try (cut & paste exactly what you provided), but
I'm getting a syntax error at the final semicolon?

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Glaesemann 2007-10-05 23:48:23 Re: timestamp interval issue
Previous Message Lonni J Friedman 2007-10-05 23:44:15 Re: timestamp interval issue