Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setting timezone for MySQL using PHPMyAdmin

Currently whenever a user creates a new account, I have a Creation_date column that has datatype timestamp. Currently this timestamp reads 3 hours ahead of EST (if it's 5PM in Boston it reads 8PM). Is there a way to change the timezone to EST? What timezone is it set to currently?

like image 288
Mobie Avatar asked Aug 07 '12 20:08

Mobie


People also ask

How do I set MySQL timezone?

Option 2: Edit the MySQL Configuration File Scroll down to the [mysqld] section, and find the default-time-zone = "+00:00" line. Change the +00:00 value to the GMT value for the time zone you want. Save the file and exit. In the example below we set the MySQL Server time zone to +08:00 (GMT +8).

How do I set the date and time in PHPMyAdmin?

To add a date information in PHPMyAdmin you need to log in the PHPMyAdmin interface and then to enter the 'Insert' tab. Then you can choose the appropriate Insert functions for each field using the drop-down list in the functions column.

What timezone is now () MySQL?

The MySQL NOW() function returns the current date and time in the configured time zone as a string or a number in the 'YYYY-MM-DD HH:MM:DD' or 'YYYYMMDDHHMMSS.


1 Answers

This has to do with MySQL's timezone.

You can set it per connection (e.g. via PHPMyAdmin) with the following:

SET time_zone = timezone;

However, this will reset if MySQL restarts. So it is better set at the server level. Which, I assume, you can't.

I encourage you to read more from the MySQL Docs.

like image 102
Jason McCreary Avatar answered Sep 20 '22 11:09

Jason McCreary