I am trying to insert the time into my database but when I print what I inserted it isn't correct. I printed the time variable before inserting it into the database and it is "12:01:09.149059". It was working fine when I was using strftime but I switched because the time was off.
from datetime import datetime
time = str(datetime.now().time())
cur.execute("insert into apple values (?,?,?)",(price,time,date))
con.commit()
#prints:
>>>('132.75', "<method 'time' of 'datetime.datetime' objects>", 'Apr 27, 2015')
Aucun commentaire:
Enregistrer un commentaire