Search Our Database

How To Fix Warning: date() [function.date] In PHP

Last updated on |

If you have encountered the following warning message at least once while running your web server, you can solve the issue but simply adding a line of code.

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. 
Please use the date.timezone setting, the TZ environment variable 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 'Asia/Kuala_Lumpur' for 'MYT/8.0/no DST' instead in ..../includes/functions.php on line 4912.

 

Step 1 – Login into web server via SSH.

Step 2 – Edit the php.ini file.

Step 3 – Add the following line of code into php.ini.

date.timezone = "Asia/Kuala_Lumpur"

Step 4 – Save and exit. Restart your web service to apply changes.