Re: Query on DATETIME for a date (the whole day)

Поиск
Список
Период
Сортировка
От Gavin Flower
Тема Re: Query on DATETIME for a date (the whole day)
Дата
Msg-id 4EB3ACEF.8080400@archidevsys.co.nz
обсуждение исходный текст
Ответ на Re: Query on DATETIME for a date (the whole day)  (Tim Landscheidt <tim@tim-landscheidt.de>)
Список 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 по дате отправления:

Предыдущее
От: Tim Landscheidt
Дата:
Сообщение: Re: Query on DATETIME for a date (the whole day)
Следующее
От: Tair Sabirgaliev
Дата:
Сообщение: Re: WARNING: pgstat wait timeout