Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • TIME ZONE ISSUE

    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 765
    Answer it

    Odoo store time in UTC timezone how it can be change to GMT timezone default thanks in advance for help.

    Description: System time is different then the time in log and if time is selected and 1am it save time 5 hours before and so the date also changes ! How It can be solved if any one have the idea kindly share it !

 1 Answer(s)

  • ~~~ Convert UTC To LocalTime

    def UTC_To_LocalTime(self, cr, uid, utcdatetime, context): zone = self.pool.get('res.users').browse(cr, uid, uid).tz or 'Asia/Kolkata' from_zone = tz.gettz('UTC') to_zone = tz.gettz(zone) try: utctime = datetime.strptime(utcdatetime, '%Y-%m-%d %H:%M:%S') except: utctime = datetime.strptime(utcdatetime, '%Y-%m-%d') utctimetz = utctime.replace(tzinfo=from_zone) # utctimetz = utctime.replace(tzinfo=to_zone) print 'utctimetz.astimezone(to_zone)',utctimetz.astimezone(to_zone).strftime("%Y-%m-%d %H:%M:%S") return utctimetz.astimezone(to_zone).strftime("%Y-%m-%d %H:%M:%S")

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: