I need to change my time zone on the server to UTC-6, since I am from Costa Rica and it is giving me the wrong time when saving data to the DB. I need your help since the project is almost delivered.
Server time can’t be changed, but you can use PHP to use a different timeline at runtime.
You can change the PHP time zone through the PHP Options menu in either the client area or control panel. You can also set it yourself in your own code with the date_default_timezone_set()
function, or by setting the date.timezone
PHP option in your .htaccess file.
But this only affects timestamps in PHP, not in MySQL. Changing the timezone in MySQL is not possible, because MySQL uses the timezone of the server. So if we want to change that, it affects everyone using the same database server, and not just your website.
For that reason, if you currently rely on MySQL to generate timestamps for you, you may want to update your code so it gets timestamps from PHP instead.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.