Function Posted February 14, 2012 Share Posted February 14, 2012 I'm getting this Time Zone error. Perhaps it's a compatibility issue with PHP 5.3. Looked all over for an answer without finding one. Here is the error message 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 /blocked.php on line 41 12/02/12 Here is the code. Line 41 is near the bottom, the one with the d,m,y. Perhaps the echo date (d/m/y") needs to be changed. Appreciate any help! <table border="3" width="16%" align="center" cellspacing="0" bgcolor="#FF6600" bordercolor="red" bordercolordark="red" bordercolorlight="red"> <tr> <td width="176"> <p align="center"><?php // shows IP Number on Page echo $ip; ?> </p> </td> </tr> </table> <p align="center"><?php // Show the user agent echo 'Your user agent is: <b>'.$_SERVER['HTTP_USER_AGENT'].'</b><br />';?></p> [b]<h1 align="center"><?php echo date("d/m/y");?></h1>[/b] </td> </tr> </table [,code] Quote Link to comment https://forums.phpfreaks.com/topic/257099-need-help-with-warning-date-functiondate-in-blockedphp/ Share on other sites More sharing options...
scootstah Posted February 14, 2012 Share Posted February 14, 2012 You haven't set a default timezone in the php.ini. Quote Link to comment https://forums.phpfreaks.com/topic/257099-need-help-with-warning-date-functiondate-in-blockedphp/#findComment-1317979 Share on other sites More sharing options...
Function Posted February 14, 2012 Author Share Posted February 14, 2012 You haven't set a default timezone in the php.ini. Added date_default_timezone_set('America/Toronto'); Still getting the error. Is there more code that needed to added to php.ini? Quote Link to comment https://forums.phpfreaks.com/topic/257099-need-help-with-warning-date-functiondate-in-blockedphp/#findComment-1317981 Share on other sites More sharing options...
darkfreaks Posted February 14, 2012 Share Posted February 14, 2012 are you including the function call in each file??? also as mentioned in the php.ini file needs to be changed to that timezone. date.timezone="America/Toronto" if you can't access the php.ini make a .htcaccess file and do this.... php_flag date.timezone ="America/Toronto" Quote Link to comment https://forums.phpfreaks.com/topic/257099-need-help-with-warning-date-functiondate-in-blockedphp/#findComment-1317991 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.