Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`[Exception] DateTime::__construct(): `It is not safe to rely on the system's timezone settings [duplicate]

I 'm using codeception (bdd) making test but gives error

[Exception]                                                                                                
  DateTime::__construct(): It is not safe to rely on the system's timezone settings. You   are *required* to   
  use the date.timezone setting 
 or the date_default_timezone_set() function. In case you used 

any of those
methods and you are still getting this warning, you most likely misspelled the timezone identifier.

We selected Europe/Helsinki for EEST/3.0/DST instead ;

can i do?

like image 858
kemal Avatar asked Jul 16 '13 17:07

kemal


2 Answers

You can use date_default_timezone_set('Europe/Istanbul'); before running this code.

For other timezones, check PHP Timezones

like image 166
YahyaE Avatar answered Oct 23 '22 15:10

YahyaE


This is an issue with your PHP configuration, not with Codeception itself.

In the command line run $ php -i | grep 'Configuration File', and then navigate to that folder. Edit php.ini and find the line that says date.timezone and set it to date.timezone = "Europe/Helsinki"

like image 8
Tro Avatar answered Oct 23 '22 14:10

Tro