Assume this code:
<?php date_default_timezone_set('UTC'); $time = gmmktime(14, 50, 0, 5, 12, 2013); echo date('Ymd H:i:s O', $time).'<br />'; echo gmdate('Ymd H:i:s O', $time).'<br />'; date_default_timezone_set('GMT'); $time = gmmktime(14, 50, 0, 5, 12, 2013); echo date('Ymd H:i:s O', $time).'<br />'; echo gmdate('Ymd H:i:s O', $time); ?>
On my local server, I get the output:
2013-05-12 14:50:00 +0000 2013-05-12 14:50:00 +0000 2013-05-12 14:50:00 +0000 2013-05-12 14:50:00 +0000
But in production, the same code produces:
2013-05-12 10:50:00 -0400 2013-05-12 14:50:00 +0000 2013-05-12 14:50:00 +0000 2013-05-12 14:50:00 +0000
Changing the operating time of the device does not affect the output.
Some information:
$ date +%Z GMT $ date +%z +0000
- PHP 5.3.25 (cli) (built: May 11, 2013 09:54:00)
- CentOS Version 5.9 (Final)
source share