About Timezones
With the USE_TZ = True
setting, Django uses timezones for the DateTimeField
. The datetimes are saved in UTC timezone in the database.
To get the time in a specific timezone, use the astimezone()
method as follows:
1 2 3 4 5 6 7 |
|
Tips and Tricks Programming Development Django 4.2 Django 3.2 Django 2.2 Python 3
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.