diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-09-08 11:00:04 -0400 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-09-08 11:00:04 -0400 |
| commit | e69348b4e7f07ef927edaecc7126901fc91c79d0 (patch) | |
| tree | e3bf89867455ee918f69245a3d4c7be5535ad155 /docs/ref/models/querysets.txt | |
| parent | b7d3b057f32ed6aa7ee0941e1f0dec9d3e9223a3 (diff) | |
Avoided mixing dates and datetimes in the examples.
Refs #16023.
Diffstat (limited to 'docs/ref/models/querysets.txt')
| -rw-r--r-- | docs/ref/models/querysets.txt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 4f5f8858b5..96fa5c9f26 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -1945,6 +1945,17 @@ SQL equivalent:: You can use ``range`` anywhere you can use ``BETWEEN`` in SQL — for dates, numbers and even characters. +.. warning:: + + Filtering a ``DateTimeField`` with dates won't include items on the last + day, because the bounds are interpreted as "0am on the given date". If + ``pub_date`` was a ``DateTimeField``, the above expression would be turned + into this SQL:: + + SELECT ... WHERE pub_date BETWEEN '2005-01-01 00:00:00' and '2005-03-31 00:00:00'; + + Generally speaking, you can't mix dates and datetimes. + .. fieldlookup:: year year @@ -1958,7 +1969,7 @@ Example:: SQL equivalent:: - SELECT ... WHERE pub_date BETWEEN '2005-01-01' AND '2005-12-31 23:59:59.999999'; + SELECT ... WHERE pub_date BETWEEN '2005-01-01' AND '2005-12-31'; (The exact SQL syntax varies for each database engine.) |
