用mysql 语句如下, 不报错:
select customer_id, approval_cash, status, apply_time, from_unixtime(apply_time,'%Y-%m-%d') as apply_time_1 from cust
![](https://img.haomeiwen.com/i7468301/e2deb3759494831b.png)
但同样的语句放入pymysql时就报错
![](https://img.haomeiwen.com/i7468301/1d316c8fe41d6e45.png)
修改如下:
原因是SQL中的单引号与‘%Y-%m’中的相冲突。
用mysql 语句如下, 不报错:
select customer_id, approval_cash, status, apply_time, from_unixtime(apply_time,'%Y-%m-%d') as apply_time_1 from cust
但同样的语句放入pymysql时就报错
修改如下:
原因是SQL中的单引号与‘%Y-%m’中的相冲突。
本文标题:mysql中将时间戳转为时间正确但用python时报错
本文链接:https://www.haomeiwen.com/subject/dktgpktx.html
网友评论