odoo将数据库时间2021-05-07 03:21:37转换为本地时间2021-05-07 11:21:37

    def get_location_time(self, time):
        tz = self.env.user.tz or 'Asia/Shanghai'
        local_format = "%Y-%m-%d %H:%M:%S"
        time_str = str(time.astimezone(pytz.timezone(tz)).strftime(local_format))
        return time_str

 

你可能感兴趣的:(odoo日常处理,python,数据库)