开发者

Storing python dates in sqlite3

开发者 https://www.devze.com 2023-03-18 01:09 出处:网络
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

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

精彩评论

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