[Snippet] Setting the timezone for PHP 5.3

PHP 5.3 requires a time zone to be set if you do any kind of date processing.

Simply set this in your php.ini

// London, England, Europe
date.timezone = "Europe/London"
date.default_latitude = 51.500181
date.default_longitude = -0.12619

Or if you are on a shared host, you can do it in a .htaccess

php_flag date.timezone = "Europe/London"
php_flag date.default_latitude = 51.500181
php_flag date.default_longitude = -0.12619

If all else fails, put the following in your code


Author: Kieran Barnes

Kieran is a PHP developer with 15 years commercial experience. Specialist in WordPress, CakePHP, CubeCart and all things PHP.

Leave a Reply

Your email address will not be published. Required fields are marked *