1

If I use in core.php

Configure::write('Config.timezone', 'Europe/Paris');

Time displayed will be 2 hour less than

date_default_timezone_set('Europe/Paris');

Should I set something else in my core.php ?

Thanks.

ndm
  • 59,784
  • 9
  • 71
  • 110
zeflex
  • 1,487
  • 1
  • 14
  • 29
  • Please alwas mention your exact CakePHP version and tag your question accordingly! Also show the actual unaffected code in question. – ndm Oct 06 '14 at 23:24
  • Sorry. Cakephp 2.x and the code affected is a simple date('Y-m-d H:i'); – zeflex Oct 07 '14 at 01:12
  • 2.x is _not_ an _exact_ version number, CakePHP version numbers consist of at least 3 digits. – ndm Oct 07 '14 at 01:14

1 Answers1

1

You should check the comment above that configuration value:

Config.timezone is available in which you can set users' timezone string. If a method of CakeTime class is called with $timezone parameter as null and Config.timezone is set, then the value of Config.timezone will be used. This feature allows you to set users' timezone just once instead of passing it each time in function calls.

The Config.timezone configuration value only applies to the CakeTime utility class, wich will use that value in case no timezone is explicitly being passed to it.

In order to configure the timezone used by built-in PHP functions you'll have to use date_default_timezone_set().

See also

ndm
  • 59,784
  • 9
  • 71
  • 110