Added updates with respect to recent changes to TimedRotatingFileHandler.
[python.git] / Doc / includes / sqlite3 / pysqlite_datetime.py
blobefa4b06ceafaddbabb97111d379bce7324b863a6
1 import sqlite3
2 import datetime
4 con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
5 cur = con.cursor()
6 cur.execute("create table test(d date, ts timestamp)")
8 today = datetime.date.today()
9 now = datetime.datetime.now()
11 cur.execute("insert into test(d, ts) values (?, ?)", (today, now))
12 cur.execute("select d, ts from test")
13 row = cur.fetchone()
14 print today, "=>", row[0], type(row[0])
15 print now, "=>", row[1], type(row[1])
17 cur.execute('select current_date as "d [date]", current_timestamp as "ts [timestamp]"')
18 row = cur.fetchone()
19 print "current_date", row[0], type(row[0])
20 print "current_timestamp", row[1], type(row[1])