Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning: date() [function.date]: [duplicate]

Tags:

date

php

datetime

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 worth of pages that have the same problem.

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');
like image 328
Tom Avatar asked May 01 '26 03:05

Tom


1 Answers

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.

like image 158
Raptor Avatar answered May 03 '26 16:05

Raptor