Jump to content

PHP TimeZone Confusion


Go to solution Solved by 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 -

 

 

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 by berridgeab
Link to comment
https://forums.phpfreaks.com/topic/280233-php-timezone-confusion/
Share on other sites

  • Solution

 

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.