tags:

views:

259

answers:

4

Does anyone know where I can read the documentation for the solution to this warning. I can search for the warning and I just get a phonebook's worth of pages that have the same problem.

Anyone?

Warning: date() [function.date]: 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.

 $config['today']=date('Y-m-d');
+4  A: 

You need to set the default timezone for PHP in either the php.ini file or in your programs entry point file.

See more information at http://php.net/manual/en/function.date.php, http://www.php.net/manual/en/function.date-default-timezone-set.php and http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone.

Nathan Kleyn
+7  A: 

it is because you do not have default time zone set in php.ini. Add this line at the beginning of your PHP.

date_default_timezone_set('America/Los_Angeles');

p.s. of course, change to your time zone.

Shivan Raptor
A: 

The method, as mentioned by Nathan, can be fixed by setting the timezone, as mentioned at:

http://www.php.net/manual/en/function.date-default-timezone-set.php

The warning, identical to your post, is mentioned on this page at:

http://www.php.net/manual/en/function.date-default-timezone-set.php#73174

Anthony
A: 

Thanks for this post, I was wonder why my PHP timezone always set to GMT +0, and not following my machine timezone, this is the reason.

I just run a test,date_default_timezone_set() only affected date(), but not time()

Shiro