diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/models/database-functions.txt | 12 | ||||
| -rw-r--r-- | docs/releases/3.2.txt | 5 |
2 files changed, 15 insertions, 2 deletions
diff --git a/docs/ref/models/database-functions.txt b/docs/ref/models/database-functions.txt index f5efdb7e87..3121a36fa9 100644 --- a/docs/ref/models/database-functions.txt +++ b/docs/ref/models/database-functions.txt @@ -623,20 +623,28 @@ that deal with date-parts can be used with ``DateField``:: ``DateTimeField`` truncation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. class:: TruncDate(expression, **extra) +.. class:: TruncDate(expression, tzinfo=None, **extra) .. attribute:: lookup_name = 'date' .. attribute:: output_field = DateField() + .. versionchanged:: 3.2 + + The ``tzinfo`` parameter was added. + ``TruncDate`` casts ``expression`` to a date rather than using the built-in SQL truncate function. It's also registered as a transform on ``DateTimeField`` as ``__date``. -.. class:: TruncTime(expression, **extra) +.. class:: TruncTime(expression, tzinfo=None, **extra) .. attribute:: lookup_name = 'time' .. attribute:: output_field = TimeField() + .. versionchanged:: 3.2 + + The ``tzinfo`` parameter was added. + ``TruncTime`` casts ``expression`` to a time rather than using the built-in SQL truncate function. It's also registered as a transform on ``DateTimeField`` as ``__time``. diff --git a/docs/releases/3.2.txt b/docs/releases/3.2.txt index d29a582d74..9017c33138 100644 --- a/docs/releases/3.2.txt +++ b/docs/releases/3.2.txt @@ -290,6 +290,11 @@ Models distinct fields if there's only one field specified in :meth:`.QuerySet.distinct`. +* The new ``tzinfo`` parameter of the + :class:`~django.db.models.functions.TruncDate` and + :class:`~django.db.models.functions.TruncTime` database functions allows + truncating datetimes in a specific timezone. + Pagination ~~~~~~~~~~ |
