MySQL 5.0 and TimeZones
Little bug with MySQL 5.0.X and PHP 5.1.4. In previous versions of PHP and MySQL < 5.0.0 you used to be able to set an environment variable called "TZ" to specify your timezone:
<?php
putenv("TZ=Africa/Johannesburg");
?>
But with MySQL 5.0.0 or later one needs to specify your timezone as follows (note in this example I'm using PEAR::DB):
<?php
/**
* Override the timezone for our MySQL session
*/
$result = $dbh->query("SET @@session.time_zone='Africa/Johannesburg'");
if (PEAR::isError($result)) {
die ($result->getMessage());
}
?>
More information about this can be found on the MySQL Time Zone Support page.