如何将pyodbc.row对象即(datetime.datetime(2018,4,6,17,5,17),)转换为datetime?

时间:2019-05-17 08:25:20

标签: python-3.x

我已经从数据库中获取了日期时间,我想以日期时间格式显示它,但我无法做到这一点

LAD = str(r)
x = datetime.datetime.strptime(LAD, "%Y-%m-%d %I:%M:%S %p")

res = Test1.execute(Command)
for r in res:
   LAD = str(r)
   x = datetime.datetime.strptime(LAD, "%Y-%m-%d %I:%M:%S %p")
   print(x)

时间数据'(datetime.datetime(2018, 4, 6, 17, 5, 17), )'与格式'%Y-%m-%d %I:%M:%S %p'

不匹配

0 个答案:

没有答案