user1807271
user1807271

Reputation: 1006

Django: Time to match time on server

When I submit a form I capture the date and time by setting default=timezone.now in my model. The captured time is 4 hours ahead of the server time. I've read through the documentation and have played around with these guys below, but still can't get them to match. How can I get django to use my server time?

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

Upvotes: 0

Views: 2763

Answers (2)

Josir
Josir

Reputation: 1644

The timezone on your settings.py should match the timezone on your operating system. If you're using Debian/Ubuntu, run:

sudo dpkg-reconfigure tzdata

to configure and see your current time zone.

Upvotes: 0

Eduardo Hitek
Eduardo Hitek

Reputation: 613

Once the Option USE_TZ is enabled, you realy need to set what is your Time Zone in the TIME_ZONE Option. Here a link with all Options Available: Time Zones

Django Framework provide a WebView in order to help you to choose what is your Time Zone. You can check here

Hope It Helps you.

Upvotes: 2

Related Questions