Warning: date () [function.date]:

Does anyone know where I can read the documentation for solving this warning. I can find a warning and I just get the phone book cost of pages with the same problem.

Warning: date () [function.date]: Cannot rely on system timezone settings. You must use the date.timezone parameter or the date_default_timezone_set () function. If you have used any of these methods and you are still getting this warning, you are most likely wrong with the timezone ID.

 $config['today'] = date('Y-m-d');

      

+2


source to share


4 answers


this is because there is no default timezone set in php.ini. Add this line to the beginning of your PHP.

date_default_timezone_set('America/Los_Angeles'); 

      



ps of course go to your timezone.

+10


source


You need to set the default timezone for PHP in a file php.ini

or in a program 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 .

+5


source


The method Nathan mentioned can be fixed by setting the timezone as stated in:

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

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

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

0


source


Thanks for this post, I was wondering why my PHP timezone is always set to GMT +0, and does not match my clockwork, here's why.

I just run test, date_default_timezone_set () only deals with date () but not time ()

0


source







All Articles