On Wed, Oct 13, 2010 at 5:46 PM, andrei <[email protected]> wrote:
> According to http://dev.mysql.com/doc/refman/5.1/en/time-zone-support.html
> it will set per-connection time zone.

See below. There's system_time_zone that you need to fire only once.
If you're not using a privileged user account to connect to the
database from web.py, you can set this var manually from console.

> I need this to store and retrieve TIMESTAMP values in local timezone.
> By default, Mysql timezone = server system timezone, which is
> different from my local timezone.

I've had a quick glance at the MySQL server documentation[1], and it
seems you have a few workarounds.

--default-time-zone=timezone

to set the server's time zone when you bring it up. This merely sets
the system time zone, so you can use a privileged user to set it from
within the mysql console:

set system_time_zone=timezone

As far as I can tell, this doesn't need to be set per-connection, but
rather as a server setting[2].

You can basically use the above when you run your server in order to
make sure you know the time zone you'll get from the server, as well
as the time zone you'll be storing. If you can help it, you should try
storing dates in UTC, and do necessary conversions after you retrieve
it from the record.


[1] 
http://dev.mysql.com/doc/refman/4.1/en/server-options.html#option_mysqld_default-time-zone
[2] 
http://dev.mysql.com/doc/refman/4.1/en/server-system-variables.html#sysvar_system_time_zone

-- 
Branko Vukelić

[email protected]
[email protected]

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to