17

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?

kemal
  • 371
  • 2
  • 4
  • 14

2 Answers2

17

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

For other timezones, check PHP Timezones

YahyaE
  • 1,057
  • 1
  • 9
  • 24
  • I did use Europe/Istanbul. the error code does not. console running – kemal Jul 16 '13 at 17:15
  • You need to write this line before run the troublesome lines. If it still goes on, share the code block so we can help you. – YahyaE Jul 16 '13 at 17:20
  • I did use this example. http://codeception.com/quickstart . I get an error when I run the console – kemal Jul 16 '13 at 17:26
  • @KemalKarakaş - That site has a lot of examples, which one did you try? And what was the error you got? – Matt Johnson-Pint Jul 16 '13 at 21:10
  • @MAttJohnson error is `code` [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 se lected 'Europe/Helsinki' for 'EEST/3.0/DST' instead `code` – kemal Jul 16 '13 at 21:53
8

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"

Tro
  • 897
  • 9
  • 32