About Creating Timezone-aware DateTimes
To create a date and time in the default timezone of the website, use:
>>> from datetime import datetime
>>> from django.utils.timezone import make_aware
>>> new_year = make_aware(datetime(2026, 1, 1))
Tips and Tricks Programming Development Django 5.2 Django 4.2
Also by me
Django Messaging 🎅🏼
For Django-based social platforms.
Django Paddle Subscriptions 🎅🏼
For Django-based SaaS projects.
Django GDPR Cookie Consent 🎅🏼
For Django websites that use cookies.