odoo里用sql语句说为日期date类型,没有转换为字符串。

开始我以为是日期now没有转换为string,一直在转换

  now = time.strftime("%Y-%m-%d %H:%M:%S")
            param = (now, id)
            # 第一次上传时间确定注意date日期一定要用引号才是字符串
            a = self.env.cr.execute(
                "update dycrm_khsx set upltim = '%s' where khmc_khsx = %s" % param)

后来才发现upltim=’%s‘在sql这里加上引号就可以了。

好了就这么多,有用方便的话,欢迎支付宝打赏哦。

 odoo里用sql语句说为日期date类型,没有转换为字符串。

  本文为原创转载请注明。