Question:
We would like to set our local timezone for web-based transactions. Our web site uses the MySql ‘now()’ function to retrieve the current time.
Is there a way to adjust the time for all our database operations?
Thanks!
Answer:
Yes. The mysql documentation describes how to set it per query at :
http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html (check this link fi the instrucitons here seem to be out of date)
As of this writing, you can do this by performing:
SET time_zone = timezone;
at the start of each session. Keep in mind that if you are doing this in a script, you’ll need to do this each time you connect (basically once per script in most cases).
If you are using one of our VPS’s you can make a global time zone setting and not perform this on each connection.