How to set default timezone in cakephp?

So, I have a system that is basically finished just cleaning out some final errors. We have a problem that the program seems to be permanently installed in the New York time zone.

I have this line of code in the core.php and bootstrap.php files:

date_default_timezone_set("Australia/Melbourne"); 

But the system continues to report that it is in America / NewYork.

Can someone help me set the time zone for Australia in Melbourne?

+6
source share
4 answers

In the config/core.php file of the application folder, try the following with single quotes:

 date_default_timezone_set('Australia/Melbourne'); 
+7
source

You can add this to config/core.php :

 Configure::write('Config.timezone', 'Europe/London'); 
+3
source

Set the time zone in the application /Config/bootstrap.php(Cakephp 2.6 +)

 date_default_timezone_set('Europe/Dublin'); ini_set('date.timezone', 'Europe/Dublin'); //Configure::write('Config.timezone', 'Europe/Dublin'); 
+3
source

As with CakePHP 3.x, the default time zone configuration is in config / bootstrap.php.

CakePHP uses the PHP time zone codes that can be found in the PHP docs here: http://php.net/manual/en/timezones.php

For example, a server in Los Angeles will be configured as follows: date_default_timezone_set('America/Los_Angeles');

+1
source

All Articles