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

痞子三分冷 提交于 2019-12-18 12:54:09

问题


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?


回答1:


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

For other timezones, check PHP Timezones




回答2:


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"



来源:https://stackoverflow.com/questions/17682725/exception-datetime-construct-it-is-not-safe-to-rely-on-the-systems-ti

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!