summaryrefslogtreecommitdiff
path: root/examples/tz.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tz.py')
-rw-r--r--examples/tz.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/tz.py b/examples/tz.py
index 0ae9fa3..8fe40af 100644
--- a/examples/tz.py
+++ b/examples/tz.py
@@ -51,7 +51,12 @@ curs.execute("INSERT INTO test_tz VALUES (%s)", (d,))
print "Inserted timestamp with timezone:", d
print "Time zone:", d.tzinfo.tzname(d), "offset:", d.tzinfo.utcoffset(d)
-curs.tzinfo_factory = FixedOffsetTimezone
+curs.execute("SELECT * FROM test_tz")
+d = curs.fetchone()[0]
+curs.execute("INSERT INTO test_tz VALUES (%s)", (d,))
+print "Inserted SELECTed timestamp:", d
+print "Time zone:", d.tzinfo.tzname(d), "offset:", d.tzinfo.utcoffset(d)
+
curs.execute("SELECT * FROM test_tz")
for d in curs:
u = d[0].utcoffset() or ZERO
@@ -59,5 +64,6 @@ for d in curs:
print "Local time:", d[0]
print "Time zone:", d[0].tzinfo.tzname(d[0]), d[0].tzinfo.utcoffset(d[0])
+
curs.execute("DROP TABLE test_tz")
conn.commit()