Re: date ranges in where

From: Erik Jones <ejones(at)engineyard(dot)com>
To: Adrian Klaver <aklaver(at)comcast(dot)net>
Cc: pgsql-general(at)postgresql(dot)org, Miguel Miranda <miguel(dot)mirandag(at)gmail(dot)com>
Subject: Re: date ranges in where
Date: 2009-05-06 23:34:23
Message-ID: 34AC44CE-B340-4056-9745-32AE2F7D5A7A@engineyard.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On May 6, 2009, at 2:59 PM, Adrian Klaver wrote:

> On Wednesday 06 May 2009 2:51:08 pm Erik Jones wrote:
>> On May 6, 2009, at 2:48 PM, Miguel Miranda wrote:
>>> Well, i tried all your sugestions, and i found some funny issues, i
>>> use the query to count exactly in a day by day basis, and running
>>> the query with
>>>
>>> WHERE lastlogin >= '2009-05-01' AND lastlogin < '2009-05-03'
>>>
>>> OR
>>>
>>> WHERE lastlogin >= 'X' AND lastlogin <= 'Y' + '1 day'::interval
>>>
>>>
>>> it includes the 0 hours of day 3:
>>>
>>> 05-02-2009 12:00:00 AM
>>
>> No, 05-02-2009 12:00:00 AM is the midnight point between 2009-05-01
>> and 2009-05-02.
>
> The problem being that midnight is both the end of one day and the
> start of
> another.

Not from perspective of the database which has no concept of
midnight. My point above was simply that 2009-05-02 12:00:00 AM is
the start of the 2nd, not the 3rd.

Erik Jones, Database Administrator
Engine Yard
Support, Scalability, Reliability
866.518.9273 x 260
Location: US/Pacific
IRC: mage2k

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Gould 2009-05-07 00:24:21 Re: PgUS 501c3 Public Charity
Previous Message Erik Jones 2009-05-06 23:32:53 Re: date ranges in where