| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера