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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Query on DATETIME for a date (the whole day)
Дата
Msg-id 21278.1319077947@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Query on DATETIME for a date (the whole day)  (Basil Bourque <basil.list@me.com>)
Список pgsql-novice
Basil Bourque <basil.list@me.com> writes:
> For a "timestamp with time zone" column, how do I find all rows where the value is within the beginning and ending of
asingle 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

> And I'm concerned about local date time. I want to find by the user's local beginning and end of the day, not UTC.

Well, you're not being too clear about what you need here, but in what
I suggest above, "midnight" will be interpreted according to the current
"timezone" setting.

            regards, tom lane

В списке pgsql-novice по дате отправления:

Предыдущее
От: Basil Bourque
Дата:
Сообщение: Query on DATETIME for a date (the whole day)
Следующее
От: Rikard
Дата:
Сообщение: Can triggers update other tables?