Jump to content

PHP TimeZone Confusion


berridgeab

Recommended Posts

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 -

 

  Quote

 

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?

Link to comment
https://forums.phpfreaks.com/topic/280233-php-timezone-confusion/
Share on other sites

  On 7/17/2013 at 1:05 PM, cyberRobot said:

 

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. ::)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.