C3rd
PHP and MySQL TimeZone Synchronization
Posted: 5 Nov 2013, 3:00am - TuesdayWe all know the PHP and MySQL holds different timezone... what if we want both PHP and MySQL sync together by adjusting your PHP code only... Here's the solution:
<?php define('TIMEZONE', 'Australia/Brisbane'); @date_default_timezone_set(TIMEZONE); $dt = new DateTime(); // get time offset $offset = $dt->format("P"); // update mysql timezone mysql_query("SET time_zone='$offset';"); ?>Thanks to Craig Buckler... Reference: http://www.sitepoint.com/synchronize-php-mysql-timezone-configuration/