symbian-qemu-0.9.1-12/python-2.6.1/Doc/includes/sqlite3/adapter_datetime.py
changeset 1 2fb8b9db1c86
equal deleted inserted replaced
0:ffa851df0825 1:2fb8b9db1c86
       
     1 import sqlite3
       
     2 import datetime, time
       
     3 
       
     4 def adapt_datetime(ts):
       
     5     return time.mktime(ts.timetuple())
       
     6 
       
     7 sqlite3.register_adapter(datetime.datetime, adapt_datetime)
       
     8 
       
     9 con = sqlite3.connect(":memory:")
       
    10 cur = con.cursor()
       
    11 
       
    12 now = datetime.datetime.now()
       
    13 cur.execute("select ?", (now,))
       
    14 print cur.fetchone()[0]