Re: Query on DATETIME for a date (the whole day) - Mailing list pgsql-novice

From Gavin Flower
Subject Re: Query on DATETIME for a date (the whole day)
Date
Msg-id 4EB3ACEF.8080400@archidevsys.co.nz
Whole thread Raw
In response to Re: Query on DATETIME for a date (the whole day)  (Tim Landscheidt <tim@tim-landscheidt.de>)
List pgsql-novice
On 04/11/11 15:02, Tim Landscheidt wrote:
> Tom Lane<tgl@sss.pgh.pa.us>  wrote:
>
>>> For a "timestamp with time zone" column, how do I find all rows where the value is within the beginning and ending
ofa single date? 
>> If you compare a date to a timestamp, the date is taken to mean midnight
>> of its day.  So you need something along the line of
>>     WHERE timestampcol BETWEEN dateval AND dateval+1
> To be exact:
>
> |       WHERE timestampcol>= dateval AND timestampcol<  dateval+1
>
> because otherwise the start of the next day is included in
> the previous and therefore potentially counted twice.
>
> Tim
>
>
Hmm...

Most people don't realize that midnight is 12am, or 00:00:00, the very
first moment in the day!  :-)

pgsql-novice by date:

Previous
From: Tim Landscheidt
Date:
Subject: Re: Query on DATETIME for a date (the whole day)
Next
From: Tair Sabirgaliev
Date:
Subject: Re: WARNING: pgstat wait timeout