开发者

Storing python dates in sqlite3

is not there any way to store python dates or pyqt4 dates (QDate) in sqlite3 ? I'd not like to use sqlite's date types since i'll need to find the difference between dates that i'll store.That's what i'm trying :

    record = QtCore.QDate.currentDate()
    latest = self.calendar.selectedDate()

    db = sql.connect(":memory:")
    cur = self.db.cursor()
    cur.execute("CREATE TABLE  invoices(record, latest)")
    cur.execute("INSERT INTO invoices VALUES (?, ?)", (record, latest)) 
    db.commit()

That's the error : sqlite3.InterfaceError: Error binding para开发者_JS百科meter 0 - probably unsupported type. Thanks in advance.


No. Convert it to a timestamp first.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜