![]() |
|
Customer Support
How do I change MySQL timezone?
The MySQL timezone is set to MST (-7 hours GMT/UTC) and is not configurable by you. MySQL is only capable of having 1 timezone setting per mysql daemon. Therefore, you cannot select NOW() and expect a result in a timezone other than MST.However, there are ways for you to get results that are in your preferred timezone. First determine how many hours your desired timezone is off from MST. For example, EST is +2 hours. PST is -1 hour.
Knowing the time offset, you can replace all your SQL statements of
with
which will give you an EST date result. For a result in PST, you would do:
If you are working with time in seconds instead of dates, then factor in the offset in seconds. Because there are 3600 seconds in an hour, and EST is 2 hours later than MST, the following converts timestamps from MST to EST:
See the MySQL Manual's Date and Time Functions for more information.
Depending on your application, you may also need to do one of the following (but not both):
1. Find every place in your code where a date or time is displayed to the browser and have a user defined function change it to add or subtract the appropriate number of hours before displaying it.
2. Find every place in your code where dates or times are input into your system and have a user defined function add or subtract the appropriate number of hours before storing it.
If you were looking for information about changing PHP's timezone, look here.
User-Contributed Notes |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
Related Questions:
How do I import delimited data into MySQL?
How do I import a MySQL dumpfile into my database?
How do I connect to my MySQL database?
How do I change my MySQL password?
How can I export data in CSV or tab delimited format?
Why do i get a query syntax error 1064 from MySQL when the syntax seems correct?
How do I export and move my database tables between servers or copy databases?
How do I create a .my.cnf MySQL preference file?
I can't connect to local MySQL server through socket 'mysql.sock'
What is my database server name?
What is my MySQL Username or Database Name?
MySQL says I have too many connections.
How do I check how much disk space my database is using?
A MySQL MYI table has errors in it.
Can I connect to MySQL remotely?
Can I connect to my MySQL database from my own computer?
I can't get phpMyAdmin to work.
phpMyAdmin gives SQL syntax error when I try to create table.
How can I use odbc_connect() in my PHP scripts to connect to MySQL?
What kind of database server do you offer?
How do I import a MySQL dumpfile into my database via phpMyAdmin?
How many databases do I get?
What am I allowed to do with my MySQL database?
Will we be able to do our own MySQL admin?
How do I export a MySQL dumpfile via phpMyAdmin?
Do you offer MySQL 5?
How do I create a MYSQL dumpfile?
How do I update my web application to connect to a different database server?
How do I create a MYSQL database for my webhosting account?
Browse Categories:Getting Started, FTP, Telnet/SSH, Moving Domains, E-mail, Traffic Reports, Mailing Lists, Apache, PHP, CGI, Other Server-Side Scripting, MySQL Database, Imaging Libraries, Other Software, Billing & Terms, Control Panel, E-commerce, Pre-Sales |

