berridgeab Posted July 17, 2013 Share Posted July 17, 2013 (edited) Hello Windows Server 2008 PHP 5.5.0 Im confused on how PHP handles TimeZone settings, please see my example below. The Windows Server 2008 server system time is set to 2013-07-17 11:23 (Windows System TimeZone - Europe/London) which can also be written as July 17th 2013 11:23 a.m for our American friends. In my PHP.ini file I set the date.timezone to "Europe/Paris". So my Windows system TimeZone is "Europe/London", but my PHP ini file setting is "Europe/Paris". I run the following code - echo date("Y-m-d H:i"); I would expect the output to be 2013-07-17 11:23, the same time as my system time. Its not, it is 2013-07-17 12:23, 1 hour ahead. I thought that if I set the timezone in the PHP.ini file, then PHP would think that it is 11.23 in Paris. However PHP seems to be detecting that the system is actually based in London from the windows server setting and adding on an extra hour. Is this the default behaviour? I can't find anything mentioned in the PHP manual. The only thing I can find mentioning anything about variable timeZones is here - http://www.php.net/manual/en/function.date-default-timezone-get.php#refsect1-function.date-default-timezone-get-description Im guessing Linux / AppleOS installations have there own timezone setting and replicate this behaviour? Edited July 17, 2013 by berridgeab Quote Link to comment https://forums.phpfreaks.com/topic/280233-php-timezone-confusion/ Share on other sites More sharing options...
cyberRobot Posted July 17, 2013 Share Posted July 17, 2013 Perhaps this helps: http://stackoverflow.com/questions/6551106/change-to-php-ini-does-not-have-effect If not, have you tried date_default_timezone_set() http://php.net/manual/en/function.date-default-timezone-set.php Quote Link to comment https://forums.phpfreaks.com/topic/280233-php-timezone-confusion/#findComment-1441058 Share on other sites More sharing options...
Solution berridgeab Posted July 17, 2013 Author Solution Share Posted July 17, 2013 Perhaps this helps: http://stackoverflow.com/questions/6551106/change-to-php-ini-does-not-have-effect If not, have you tried date_default_timezone_set() http://php.net/manual/en/function.date-default-timezone-set.php Thank you for your response. I realised that my code had a parameter in the wrong place which mean't that a time that was an hour out was in the wrong place. Quote Link to comment https://forums.phpfreaks.com/topic/280233-php-timezone-confusion/#findComment-1441078 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.