#32366: Update usage of now() &co
------------------------------------------------+--------------------------
Reporter: Carlton Gibson | Owner: nobody
Type: Cleanup/optimization | Status: assigned
Component: Utilities | Version: 4.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+--------------------------
Using datetime.now(), rather than utcnow() is the modern recommended
approach.
Warning in docs:
> ... the recommended way to create an object representing the current
time in UTC is by calling datetime.now(timezone.utc).
https://docs.python.org/3.9/library/datetime.html#datetime.datetime.now
https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow
More depth here:
https://blog.ganssle.io/articles/2019/11/utcnow.html
`datetime.utcfromtimestamp()` and `datetime.utctimetuple()` carry similar
warnings.
* Update the code to modern usage.
* Update docs examples (for backport to stable docs).
--
Ticket URL: <https://code.djangoproject.com/ticket/32366>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/056.b7e2e5af0d0e93f24569434b33aa86c1%40djangoproject.com.