Re: [SQL] How to compare Datetime

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] How to compare Datetime
Дата
Msg-id 23586.924363991@sss.pgh.pa.us
обсуждение исходный текст
Список pgsql-sql
Henrik Pedersen <HenrikP@utp.dk> writes:
> Im having some problems with the datetime fields

datetime is a date and time, not just a date.  The behavior you describe
is all perfectly correct once you realize that your constants are being
interpreted as midnight of the given date.

If you only want to store the date, and not the time of day, your column
datatype should be "date" not datetime.

If you do want to store an exact time, then datetime is the right thing
to use.  You can perform tests on it with one-day resolution by using
the date_part function to extract just the date.  See the User's Guide.
        regards, tom lane


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

Предыдущее
От: Ady-55
Дата:
Сообщение: ...
Следующее
От: david
Дата:
Сообщение: Impossible query with SQL? or not?