Re: timestamp interval issue - Mailing list pgsql-novice

From Michael Glaesemann
Subject Re: timestamp interval issue
Date
Msg-id 822A4F4F-1D2C-4D67-99E8-14E5A554E5EE@seespotcode.net
Whole thread Raw
In response to timestamp interval issue  ("Lonni J Friedman" <netllama@gmail.com>)
Responses Re: timestamp interval issue  ("Lonni J Friedman" <netllama@gmail.com>)
List pgsql-novice
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.

Michael Glaesemann
grzm seespotcode net



pgsql-novice by date:

Previous
From: "Lonni J Friedman"
Date:
Subject: Re: timestamp interval issue
Next
From: Michael Glaesemann
Date:
Subject: Re: timestamp interval issue