Friday, 27 July 2018

How to fix date It is not safe to rely on the systems timezone settings php

How to fix date It is not safe to rely on the systems timezone settings php




When you use the date function sometimes, if theres no specific configuration, you will see this error:

date(): It is not safe to rely on the systems timezone settings

 

How to fix date(): It is not safe to rely on the systems timezone settings

Solution #1
configure date.timezone in your php.ini configuration file. If you have no access to php.ini check the 2nd Solution.

Solution #2
Use date_default_timezone_set() or ini_set() inside your <?php  code

Example:
date_default_timezone_set(Europe/Rome);


The complete list of the supported time zones can be found on http://php.net/manual/en/timezones.php

go to link download