【发布时间】:2012-09-07 16:44:18
【问题描述】:
我使用 PostgreSQL 8.4.11 并发现奇怪的错误。当我查询时:
SELECT "documents_document"."given_on"
FROM "documents_document"
WHERE (EXTRACT('month' FROM "documents_document"."given_on") = 1
AND "documents_document"."given_on"
BETWEEN '1-01-01 00:00:00' and '1-12-31 23:59:59.999999')
ORDER BY "documents_document"."created_on" DESC
我得到结果:
given_on
------------
2002-01-16
2011-01-25
2012-01-12
2012-01-12
2012-01-12
2012-01-20
2012-01-19
2012-01-13
2012-01-31
2012-01-16
2012-01-31
2012-01-12
...
为什么?
我希望日期在 1-01-01 ... 1-12-31 之间。
【问题讨论】:
标签: sql postgresql datetime postgresql-8.4