lundi 22 décembre 2014

timestamp column in sqlite return string in python

i create a table with SQLite Date Browse App ...


when i want retrieve datetime value from timestamp column , SQLite return unicod type ...


enter image description here


this is my insert code :



def Insert(self,mode,path,vname,stime,ftime):
con = sqlite3.connect(PATH_DataBase) # @UndefinedVariable
con.execute('INSERT INTO SendList VALUES(?,?,?,?,?)',(mode,path,vname,stime,ftime))
con.commit()
con.close()

dt1 = datetime.datetime(2013,01,01,01,01,01,0)
dt2 = datetime.datetime(2015,01,01,01,01,01,0)
c = 0
for f in os.listdir('/home/abbas/test/'):
c += 1
slist.Insert(common.MODE_Bluetooth_JAVA, '/home/abbas/test/'+f,'flower'+str(c) , dt1, dt2)


and now this is my table :


enter image description here


but when i want compare starttime with datetime.now() python give me error :


TypeError: can't compare datetime.datetime to unicode


Aucun commentaire:

Enregistrer un commentaire