1

According to Django : RunTimeWarning : DateTimeField received a naive datetime while time zone support is active, get today's date with timezone information with

from django.utils import timezone
today = timezone.now()

When I do:

from datetime import timedelta
yesterday = today - timedelta(days=1)

But now yesterday is no longer timezone aware. How do I maintain the timezone awareness while doing date and time arithmetic?

Code-Apprentice
  • 76,639
  • 19
  • 130
  • 241

0 Answers0