Documentation Home
MySQL Connector/Python Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 0.7Mb
PDF (A4) - 0.7Mb


10.2.48 MySQLConnection.time_zone Property

This property is used to set or retrieve the time zone session variable for the current connection.

Press CTRL+C to copy
>>> cnx.time_zone = '+00:00' >>> cursor = cnx.cursor() >>> cursor.execute('SELECT NOW()') ; cursor.fetchone() (datetime.datetime(2012, 6, 15, 11, 24, 36),) >>> cnx.time_zone = '-09:00' >>> cursor.execute('SELECT NOW()') ; cursor.fetchone() (datetime.datetime(2012, 6, 15, 2, 24, 44),) >>> cnx.time_zone u'-09:00'

Returns a string.