Change MySQL timezone during MySQL Connect

If you are using NOW() at your MySQL query, you may have problem when you hosted the file at different timezone server.

The easier way to set your timezone without needed to configure the MySQL server is to use “SET time_zone” at you mysqli connect level.

$DBconn = new mysqli("hostname", "username", "password", "databasename");
$DBconn->query("SET time_zone='+08:00'");
Tagged: Tags:

Leave A Comment?