Aug 2, 2012

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

If you find a semicolon in front of it, remove it. This directive will hold your default timezone. You can choose a timezone from the official PHP website.
We will use America/Los_Angeles as example. Fill in the value of the timezone as this:
date.timezone = America/Mexico_City


Save your php.ini file and restart your server. From now on, your date/time functions will rely on this setting.
The second option to solve this warning is by using a already existing PHP build-in function “date_default_timezone_set()”. Somewhere before your date/time function type the following line as this:
<?php
// Set timezone
date_default_timezone_set('America/Mexico_City');

// Create string, date of tomorrow
echo date('Y m-d', strtotime('+1 day', time()));
?>


Add the following line to .htaccess:
SetEnv TZ America/Mexico_City



SOURCE 1   SOURCE 2

No comments: