Re: psycopg2: parsing timestamps with odd time zones
Karsten Hilbert <[email protected]> Wed, 19 May 2010 17:19:34 +0200
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
On Wed, May 19, 2010 at 05:11:03PM +0200, Karsten Hilbert wrote: > > I don't know exactly the type of strings TSTZ_W_SECS expects (and the > > object it returns): it would be nice to have a few of them in the test > > suite, both for testing and documentation. > > As for testing try setting your timezone to Asia/Colombo or > Asia/Calcutta and go back in time far enough. Such as with this script: import psycopg2 print "psycopg2:", psycopg2.__version__ dsn = u'dbname=... user=... password=... sslmode=prefer' conn = psycopg2.connect(dsn=dsn) curs = conn.cursor() cmd = "set timezone to 'Asia/Colombo'" curs.execute(cmd) cmd = "select '1901-01-01 11:11:11.111+01'::timestamp with time zone" curs.execute(cmd) print curs.fetchall() curs.close() conn.close() Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346