For CakePHP 3.0, set the default time zone in bootstrap.php Line 95-99
date_default_timezone_set('Asia/Karachi');
PHP timezone list.
To synchronize it with the database, also set the database time zone in the application line 216-238 on the app.php page
'Datasources' => [ 'default' => [ 'className' => 'Cake\Database\Connection', 'driver' => 'Cake\Database\Driver\Mysql', 'persistent' => false, 'host' => 'localhost', /** * CakePHP will use the default DB port based on the driver selected * MySQL on MAMP uses port 8889, MAMP users will want to uncomment * the following line and set the port accordingly */ //'port' => 'non_standard_port_number', 'username' => 'root', 'password' => '', 'database' => 'invoicing', 'encoding' => 'utf8', 'timezone' => '+8:00', // It can be UTC or "+10:00" or "-4:00" 'flags' => [], 'cacheMetadata' => true, 'log' => false,
MySQL Reference
source share