Sophie Tagar
Sophie Tagar

Reputation: 100

Django DateTime

I'm using Django and when I retrieve instance (with objects.all()) the models.DateTime are changing so that 7 hours are added.

I'm in the US Pacific time zone and I'm guessing that my DB is defined as UTC I'm using PostgreSQL and I can't figure out where is the setting for time zone.

One other thing I'm also getting this warning:

RuntimeWarning: DateTimeField received a naive datetime while time zone support is active.

Maybe the two are connected?

Upvotes: 1

Views: 295

Answers (1)

Ykh
Ykh

Reputation: 7717

settings.py:

TIME_ZONE = 'America/Los_Angeles'
# database not use UTC
USE_TZ = False

see this

Upvotes: 2

Related Questions