How to change the MySQL timezone

When you develop your website, you may have to compare a certain date/time with the current date/time on the server.

The timezone on servers is CST. This is a global setting which cannot be changed.

You can, however, use an easy workaround if you wish to use a different timezone - you can modify the return of the MySQL NOW() function.

Let's take a look at the most standard query for selecting the current date/time:


If you want to add 2 hours to the result, you can use the following syntax:


In a similar way, if you want to subtract 2 hours from the server timezone, you can use this query:


Using DATE_SUB and DATE_ADD, you can modify the query result to fit your specific needs.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What type of databases do you support? PGSQL and MySQL?

All our servers support MySQL and PostgreSQL databases. Also with any of our hosting packages...

How to repair a MySQL database?

In this article we will show you two ways to repair a MySQL database.  1) Through...

How to optimize a MySQL database using phpMyAdmin?

It is always a good idea to keep your databases' tables optimized. Fortunately, making this...

How to change the database engine of a MySQL database table?

In this article we will show you how to change the database engine of a MySQL table. Let's...

I get an error 'ACCESS DENIED CREATE DATABASE db_name' when I try to import a database

In order to solve this issue follow these steps: Open the MySQL dump with a text editor on...