Php – How to fix PHP errors related to timezone (function.strtotime and function.date)

PHP

Upgrading to a new server, I two repeated errors:

Warning: strtotime() [function.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 'America/New_York' for 'EST/-5.0/no DST' instead in…

and

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. We
selected 'America/New_York' for 'EST/-5.0/no DST' instead in

How do I go about fixing these?

Code in question is this:

'date' => date("Y-M-d",strtotime($Array['_dateCreated'])),

I've tried putting this in an include at the top of all my pages:

<?php
date_default_timezone_set('America/New_York');
?>

Thanks in advance for your help.

Best Answer

date.timezone in php.ini can fix this globally.

Related Topic