Search the Community
Showing results for tags 'current year'.
-
After my web hosting company (1and1.com) switched from PHP 4 to 5, a script that once returned the current year A-OK no longer works; it now generates this error message that is e-mailed to me every time a page bearing this include is accessed: An error occurred in script '----------/includes/footer.php' on line 4: <br />date_default_timezone_get() [<a href='function.date-default-timezone-get'>function.date-default-timezone-get</a>]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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 <br />Date/Time: 1-30-2013 07:51:12 <br /><pre>Array .... Here is the code, including some changes I thought should correct the error or at least suppress the error messages: <?php if(function_exists("date_default_timezone_set") and function_exists("date_default_timezone_get")) @date_default_timezone_set(@date_default_timezone_get()); // date_default_timezone_set('America/New_York'); $startyear = 2009; $currentyear = date("Y"); if ($startyear == $currentyear) { echo 'Copyright © 2009'; } else { echo 'Copyright © 2009 - ' . $currentyear; } ?> How can I fix this error?
- 4 replies
-
- php
- current year
-
(and 1 more)
Tagged with: