diff options
Diffstat (limited to 'Doc/lib/sqlite3/adapter_datetime.py')
-rw-r--r-- | Doc/lib/sqlite3/adapter_datetime.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Doc/lib/sqlite3/adapter_datetime.py b/Doc/lib/sqlite3/adapter_datetime.py index dc41ce8..3460498 100644 --- a/Doc/lib/sqlite3/adapter_datetime.py +++ b/Doc/lib/sqlite3/adapter_datetime.py @@ -1,14 +1,14 @@ -import sqlite3
-import datetime, time
-
-def adapt_datetime(ts):
- return time.mktime(ts.timetuple())
-
-sqlite3.register_adapter(datetime.datetime, adapt_datetime)
-
-con = sqlite3.connect(":memory:")
-cur = con.cursor()
-
-now = datetime.datetime.now()
-cur.execute("select ?", (now,))
-print cur.fetchone()[0]
+import sqlite3 +import datetime, time + +def adapt_datetime(ts): + return time.mktime(ts.timetuple()) + +sqlite3.register_adapter(datetime.datetime, adapt_datetime) + +con = sqlite3.connect(":memory:") +cur = con.cursor() + +now = datetime.datetime.now() +cur.execute("select ?", (now,)) +print cur.fetchone()[0] |