Assuming that the current time is '12/08/2014 03:24:05 ' and rectified in the database and the time is '12/08/2014 09:54:05'; gather that this adding seven hours.The user can set the time zone 'Asia/Kolkata'.Taking the approximate timezone create_date field.I want that proper time in database.
Anyone have any idea ?
Since OpenERP 6.1, the timezone of all Python operations happening on the server-side (and in modules) is forced to be UTC. This was a design decision explained in various places. The rendering of datetime values in the user's timezone is meant to be done on the client-side exclusively.
from openerp.osv import fields from datetime import datetime my_date = fields.datetime.context_timestamp(cr, uid, datetime.now(), context=context) print "My Datetime: ", my_date print "Hour: ", my_date.hour
My Datetime: 2013-06-06 12:28:22.249559+05:30 Hour: 12
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 8/12/14, 6:01 AM|
|Seen: 779 times|
|Last updated: 5/28/15, 2:45 AM|