最近有个python项目需要更新mysql时间,类型是datetime,参考了网上的建议,将时间转为字符串再写入数据库。
def toMysqlDateTime():
dt=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
return dt
转载于:https://blog.51cto.com/476946/1945225
最近有个python项目需要更新mysql时间,类型是datetime,参考了网上的建议,将时间转为字符串再写入数据库。
def toMysqlDateTime():
dt=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
return dt
转载于:https://blog.51cto.com/476946/1945225