SET PHP & MySQL timezone, per Session
How to define a timezone (different from the server) per Session in PHP & MySQL
Sometimes I need to change the timezone for a specific project and for some reason I can not change the server timezone.
These cases allways set the timezone for PHP and MySQL as explained:
# define PHP timezone
date_default_timezone_set('America/Sao_Paulo');
# define MySQL timezone based on the PHP configuration, after the database connection
mysql_query("SET `time_zone` = '".date('P')."'”);
List of Supported Timezones
http://php.net/manual/en/timezones.php
Go Back