18ec7f656134b1230ab23003a94ba3266d7064122Georg Brandlimport sqlite3 28ec7f656134b1230ab23003a94ba3266d7064122Georg Brandlimport datetime 38ec7f656134b1230ab23003a94ba3266d7064122Georg Brandl 48ec7f656134b1230ab23003a94ba3266d7064122Georg Brandlcon = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES) 58ec7f656134b1230ab23003a94ba3266d7064122Georg Brandlcur = con.cursor() 68ec7f656134b1230ab23003a94ba3266d7064122Georg Brandlcur.execute("create table test(d date, ts timestamp)") 78ec7f656134b1230ab23003a94ba3266d7064122Georg Brandl 88ec7f656134b1230ab23003a94ba3266d7064122Georg Brandltoday = datetime.date.today() 98ec7f656134b1230ab23003a94ba3266d7064122Georg Brandlnow = datetime.datetime.now() 108ec7f656134b1230ab23003a94ba3266d7064122Georg Brandl 118ec7f656134b1230ab23003a94ba3266d7064122Georg Brandlcur.execute("insert into test(d, ts) values (?, ?)", (today, now)) 128ec7f656134b1230ab23003a94ba3266d7064122Georg Brandlcur.execute("select d, ts from test") 138ec7f656134b1230ab23003a94ba3266d7064122Georg Brandlrow = cur.fetchone() 148ec7f656134b1230ab23003a94ba3266d7064122Georg Brandlprint today, "=>", row[0], type(row[0]) 158ec7f656134b1230ab23003a94ba3266d7064122Georg Brandlprint now, "=>", row[1], type(row[1]) 168ec7f656134b1230ab23003a94ba3266d7064122Georg Brandl 178ec7f656134b1230ab23003a94ba3266d7064122Georg Brandlcur.execute('select current_date as "d [date]", current_timestamp as "ts [timestamp]"') 188ec7f656134b1230ab23003a94ba3266d7064122Georg Brandlrow = cur.fetchone() 198ec7f656134b1230ab23003a94ba3266d7064122Georg Brandlprint "current_date", row[0], type(row[0]) 208ec7f656134b1230ab23003a94ba3266d7064122Georg Brandlprint "current_timestamp", row[1], type(row[1]) 21