date() – Peter Bending https://peterbending.com PWJB Thu, 02 May 2013 00:18:40 +0000 en-US hourly 1 https://wordpress.org/?v=5.3.12 https://peterbending.com/wp-content/uploads/2019/03/cropped-pwjb-logo-1-32x32.png date() – Peter Bending https://peterbending.com 32 32 PHP 5.1 date(): getdate(): and assorted Time Zone errors https://peterbending.com/latest/php-5-1-date-getdate-and-assorted-time-zone-errors/ https://peterbending.com/latest/php-5-1-date-getdate-and-assorted-time-zone-errors/#respond Mon, 31 Jan 2011 01:13:03 +0000 http://peterbending.com/?p=137 Continue reading "PHP 5.1 date(): getdate(): and assorted Time Zone errors"

]]>
Ok So you have your Apache server WIth PHP installed and you keep getting this error on your sites

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 ‘UTC’ for ‘GMT/0.0/no DST’ instead

OR

getdate(): 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 ‘UTC’ for ‘GMT/0.0/no DST’ instead

It turns out your shiny new server set up has changed if your using PHP 5.1 or greater you now need to tell php what time zone to use.

Rather than editing all your sites / scripts just update your .htaccess with

php_value date.timezone Europe/London

You can also set the default time zone in your php.ini file if you have access / the script should revert to UTC or GMt as it used to be but you will get the E_warning as above.

replacing Europe/London with the appropriate time zone for your server see full list: http://www.php.net/manual/en/timezones.php

]]>
https://peterbending.com/latest/php-5-1-date-getdate-and-assorted-time-zone-errors/feed/ 0