summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/intro/tutorial02.txt2
-rw-r--r--docs/ref/models/database-functions.txt36
-rw-r--r--docs/ref/signals.txt2
-rw-r--r--docs/topics/i18n/timezones.txt2
4 files changed, 21 insertions, 21 deletions
diff --git a/docs/intro/tutorial02.txt b/docs/intro/tutorial02.txt
index 6a87d2d01c..f78a83d1bd 100644
--- a/docs/intro/tutorial02.txt
+++ b/docs/intro/tutorial02.txt
@@ -376,7 +376,7 @@ Once you're in the shell, explore the :doc:`database API </topics/db/queries>`:
>>> q.question_text
"What's new?"
>>> q.pub_date
- datetime.datetime(2012, 2, 26, 13, 0, 0, 775217, tzinfo=datetime.timezone.utc)
+ datetime.datetime(2012, 2, 26, 13, 0, 0, 775217, tzinfo=datetime.UTC)
# Change values by changing the attributes, then calling save().
>>> q.question_text = "What's up?"
diff --git a/docs/ref/models/database-functions.txt b/docs/ref/models/database-functions.txt
index 089e02d15e..aa18ed4045 100644
--- a/docs/ref/models/database-functions.txt
+++ b/docs/ref/models/database-functions.txt
@@ -355,7 +355,7 @@ that deal with date-parts can be used with ``DateField``:
.. code-block:: pycon
- >>> from datetime import datetime, timezone
+ >>> from datetime import UTC, datetime
>>> from django.db.models.functions import (
... ExtractDay,
... ExtractMonth,
@@ -366,8 +366,8 @@ that deal with date-parts can be used with ``DateField``:
... ExtractIsoYear,
... ExtractYear,
... )
- >>> start_2015 = datetime(2015, 6, 15, 23, 30, 1, tzinfo=timezone.utc)
- >>> end_2015 = datetime(2015, 6, 16, 13, 11, 27, tzinfo=timezone.utc)
+ >>> start_2015 = datetime(2015, 6, 15, 23, 30, 1, tzinfo=UTC)
+ >>> end_2015 = datetime(2015, 6, 16, 13, 11, 27, tzinfo=UTC)
>>> Experiment.objects.create(
... start_datetime=start_2015,
... start_date=start_2015.date(),
@@ -424,7 +424,7 @@ Each class is also a ``Transform`` registered on ``DateTimeField`` as
.. code-block:: pycon
- >>> from datetime import datetime, timezone
+ >>> from datetime import UTC, datetime
>>> from django.db.models.functions import (
... ExtractDay,
... ExtractHour,
@@ -438,8 +438,8 @@ Each class is also a ``Transform`` registered on ``DateTimeField`` as
... ExtractIsoYear,
... ExtractYear,
... )
- >>> start_2015 = datetime(2015, 6, 15, 23, 30, 1, tzinfo=timezone.utc)
- >>> end_2015 = datetime(2015, 6, 16, 13, 11, 27, tzinfo=timezone.utc)
+ >>> start_2015 = datetime(2015, 6, 15, 23, 30, 1, tzinfo=UTC)
+ >>> end_2015 = datetime(2015, 6, 16, 13, 11, 27, tzinfo=UTC)
>>> Experiment.objects.create(
... start_datetime=start_2015,
... start_date=start_2015.date(),
@@ -664,12 +664,12 @@ that deal with date-parts can be used with ``DateField``:
.. code-block:: pycon
- >>> from datetime import datetime, timezone
+ >>> from datetime import UTC, datetime
>>> from django.db.models import Count
>>> from django.db.models.functions import TruncMonth, TruncYear
- >>> start1 = datetime(2014, 6, 15, 14, 30, 50, 321, tzinfo=timezone.utc)
- >>> start2 = datetime(2015, 6, 15, 14, 40, 2, 123, tzinfo=timezone.utc)
- >>> start3 = datetime(2015, 12, 31, 17, 5, 27, 999, tzinfo=timezone.utc)
+ >>> start1 = datetime(2014, 6, 15, 14, 30, 50, 321, tzinfo=UTC)
+ >>> start2 = datetime(2015, 6, 15, 14, 40, 2, 123, tzinfo=UTC)
+ >>> start3 = datetime(2015, 12, 31, 17, 5, 27, 999, tzinfo=UTC)
>>> Experiment.objects.create(start_datetime=start1, start_date=start1.date())
>>> Experiment.objects.create(start_datetime=start2, start_date=start2.date())
>>> Experiment.objects.create(start_datetime=start3, start_date=start3.date())
@@ -744,7 +744,7 @@ Usage example:
.. code-block:: pycon
- >>> from datetime import date, datetime, timezone
+ >>> from datetime import UTC, date, datetime
>>> from django.db.models import Count
>>> from django.db.models.functions import (
... TruncDate,
@@ -754,7 +754,7 @@ Usage example:
... TruncSecond,
... )
>>> import zoneinfo
- >>> start1 = datetime(2014, 6, 15, 14, 30, 50, 321, tzinfo=timezone.utc)
+ >>> start1 = datetime(2014, 6, 15, 14, 30, 50, 321, tzinfo=UTC)
>>> Experiment.objects.create(start_datetime=start1, start_date=start1.date())
>>> melb = zoneinfo.ZoneInfo("Australia/Melbourne")
>>> Experiment.objects.annotate(
@@ -767,8 +767,8 @@ Usage example:
{'date': datetime.date(2014, 6, 15),
'day': datetime.datetime(2014, 6, 16, 0, 0, tzinfo=zoneinfo.ZoneInfo('Australia/Melbourne')),
'hour': datetime.datetime(2014, 6, 16, 0, 0, tzinfo=zoneinfo.ZoneInfo('Australia/Melbourne')),
- 'minute': 'minute': datetime.datetime(2014, 6, 15, 14, 30, tzinfo=timezone.utc),
- 'second': datetime.datetime(2014, 6, 15, 14, 30, 50, tzinfo=timezone.utc)
+ 'minute': 'minute': datetime.datetime(2014, 6, 15, 14, 30, tzinfo=UTC),
+ 'second': datetime.datetime(2014, 6, 15, 14, 30, 50, tzinfo=UTC)
}
``TimeField`` truncation
@@ -799,12 +799,12 @@ that deal with time-parts can be used with ``TimeField``:
.. code-block:: pycon
- >>> from datetime import datetime, timezone
+ >>> from datetime import UTC, datetime
>>> from django.db.models import Count, TimeField
>>> from django.db.models.functions import TruncHour
- >>> start1 = datetime(2014, 6, 15, 14, 30, 50, 321, tzinfo=timezone.utc)
- >>> start2 = datetime(2014, 6, 15, 14, 40, 2, 123, tzinfo=timezone.utc)
- >>> start3 = datetime(2015, 12, 31, 17, 5, 27, 999, tzinfo=timezone.utc)
+ >>> start1 = datetime(2014, 6, 15, 14, 30, 50, 321, tzinfo=UTC)
+ >>> start2 = datetime(2014, 6, 15, 14, 40, 2, 123, tzinfo=UTC)
+ >>> start3 = datetime(2015, 12, 31, 17, 5, 27, 999, tzinfo=UTC)
>>> Experiment.objects.create(start_datetime=start1, start_time=start1.time())
>>> Experiment.objects.create(start_datetime=start2, start_time=start2.time())
>>> Experiment.objects.create(start_datetime=start3, start_time=start3.time())
diff --git a/docs/ref/signals.txt b/docs/ref/signals.txt
index 953b18c1f6..6e040cbfda 100644
--- a/docs/ref/signals.txt
+++ b/docs/ref/signals.txt
@@ -88,7 +88,7 @@ Argument Value
arguments passed to ``__init__()``)
``kwargs`` ``{'question_text': "What's new?",``
- ``'pub_date': datetime.datetime(2012, 2, 26, 13, 0, 0, 775217, tzinfo=datetime.timezone.utc)}``
+ ``'pub_date': datetime.datetime(2012, 2, 26, 13, 0, 0, 775217, tzinfo=datetime.UTC)}``
========== ===============================================================
``post_init``
diff --git a/docs/topics/i18n/timezones.txt b/docs/topics/i18n/timezones.txt
index 0d866dac6c..905cb5c615 100644
--- a/docs/topics/i18n/timezones.txt
+++ b/docs/topics/i18n/timezones.txt
@@ -137,7 +137,7 @@ used.
However, :ref:`as explained above <naive-datetime-objects>`, this isn't
entirely reliable, and you should always work with aware datetimes in UTC
in your own code. For instance, use :meth:`~datetime.datetime.fromtimestamp`
- and set the ``tz`` parameter to :attr:`~datetime.timezone.utc`.
+ and set the ``tz`` parameter to :obj:`datetime.UTC`.
Selecting the current time zone
-------------------------------