Ever seen the following error on one of your developed websites?

Warning: strtotime(): 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. We selected the timezone ‘UTC’ for now, but please set date.timezone to select your timezone. in /home/folder/public_html/libraries/joomla/utilities/date.php on line 56

REASON

It seems that PHP rewrote the date/time functions from version 5.1.0 upwards. Every call to a date/time function will now generate a E_NOTICE if the timezone is not valid, and/or a E_WARNING message if using the system settings or the TZ environment variable.

Bummer.

They have decided that it is not safe to rely on the system’s timezone settings, so they require the programmer to use the date.timezone setting or the date_default_timezone function.

SOLUTION

Open the file in question, and place this first, within the <?php ?> braces:

date_default_timezone_set(timezone_identifier);

An example for Lagos, West Africa’s time zone is:

date_default_timezone_set(“Africa/Lagos”);

STILL SEEING THE WARNING?

Then you must have misspelled the timezone identifier. Check the list of valid identifiers in the Supported Timezones list.

Previously published on Daydah Blog

Adverts