Setting the time zone for MySQL using PHPMyAdmin

Currently, when the user creates a new account, I have a Creation_date column with the timestamp data type. This timestamp is currently read 3 hours before EST (if 5PM in Boston reads 8pm). Is there a way to change the time zone to EST? What time zone is set?

+7
source share
4 answers

This is due to the time zone of MySQL.

You can set it for each connection (for example, via PHPMyAdmin) as follows:

 SET time_zone = timezone; 

However, if MySQL reboots, it will reset. Therefore, it is better installed at the server level. Which, I suppose, you cannot.

I recommend that you learn more from MySQL Docs .

+7
source

Accordingly, this question

 SET SESSION time_zone = '+8:00' 
+4
source

TIMESTAMP values ​​are converted to UTC when inserted into the database and converted back to the current time zone set in MySQL when retrieving. Other answers show how to set the timezone in MySQL, which will determine what value is output from the database.

Another option is to use the DATETIME column, save all your dates in UTC and convert them to the required time zone in your application (PHP or wherever you get the values).

+2
source

SET GLOBAL time_zone = time zone;

0
source

All Articles