While Inserting time in to mysql database through django project it is stored as standard Greenwich time but not my standard time GMT+5.30. Example when i am giving 5.30 PM through django it is stored as 12.00 AM.How it could be resolved
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are using Django 1.4+ with
USE_TZ=Truethe datetimes are converted to UTC when they are passed to MySQL. When they are retrieved back, Django converts these datetimes to the timezone in use.If you want to store local times (usually not a good idea) you can turn off timezone management:
USE_TZ=False.If you want to store TZ information on DB, you will have to switch to PostgreSQL.
Django and timezones documentation:
https://docs.djangoproject.com/en/dev/topics/i18n/timezones/