How can I change my MySQL database's timezone?

  • Answered
I am a bit unsure how to, but I was wondering if the database's timezone was set on the hosting end. Currently, when I submit data with a CURRRENT_TIMESTAMP, the time is 1 hour behind.

Does anyone know how I can change it? Or could possibly point me to the right direction? Thanks.

EDIT: Ah, so I've found the variables tab on my phpMyAdmin page, and there is a date_format that has been preset. Maybe I can somehow edit that to knock the time back to CST?
Hello SeenBean, and thanks for your question. On a shared server the MySQL time zone is set to the local timezone of that server, in your case EST, and this can't be changed. However you can adjust it on the fly to your needs using a few built in MySQL commands. How to convert MySQL time The following command would take the MySQL NOW() command that gives back the current time stamp, and then you can specify two time zones, the first being EST (-05:00) and the second being CST (-06:00) to get your time zone out of the EST time stamps: SELECT CONVERT_TZ(NOW(),'-05:00','-06:00'); You can also use the DATE_ADD and DATE_SUB commands to add or subtract hours for the current time stamp on the server as well: SELECT DATE_ADD(NOW(), INTERVAL 1 HOUR);
SELECT DATE_SUB(NOW(), INTERVAL 1 HOUR); For further reading you can also check out the MySQL documentation on date and time functions below: MySQL date and time functions Please let us know if you have any other questions at all. - Jacob