The Meaning of GMT+11 in PHP

The Meaning of GMT+11 in PHP

Do you ever need to work with Time Zone info in your code? If no, you are lucky, if yes, then you might have encountered the strange interpretations of “GMT+11” in PHP. In common sense, either “UTC+11” or “GMT+11” would mean the GMT time + 11 hours, which will be the Standard Australian Eastern time in the daylight savings. However, if you ask PHP, you will get different result:


print 'GMT+11: '.date('Y-m-d H:i:s')."\n";

print 'GMT-11: '.date('Y-m-d H:i:s')."\n";

print 'UTC time: '.date('Y-m-d H:i:s')."\n";

Will give you the following result: [generic] GMT+11: 2013-12-18 13:14:53 GMT-11: 2013-12-19 11:14:53 UTC time: 2013-12-19 00:14:53 [/generic] I am in Australia, and my “date” tells me: [generic] dhcp-105:~ ericlin$ date Thu Dec 19 11:15:12 EST 2013 [/generic] You can see that my time actually matches with “GMT-11”, not “GMT+11”, surprise, right? So be careful when you need to use time zone strings in PHP, give it a second though or you will face problems.


Leave a Reply

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

My new Snowflake Blog is now live. I will not be updating this blog anymore but will continue with new contents in the Snowflake world!