Edit report at https://bugs.php.net/bug.php?id=64824&edit=1
ID: 64824
User updated by: daliuskal at gmail dot com
Reported by: daliuskal at gmail dot com
Summary: date_default_timezone_set('UTC') bug
-Status: Open
+Status: Closed
Type: Bug
Package: *General Issues
Operating System: CentOS release 5.9 (Final)
PHP Version: 5.3.25
Block user comment: N
Private report: N
New Comment:
phpinfo() showed "Olson" Timezone Database Version as 0.system, so I used the
command
$ pecl upgrade timezonedb
and added
extension=timezonedb.so
to php.ini
After restarting the server, the problem has been resolved with the new
timezone
DB version 2013.3
Previous Comments:
------------------------------------------------------------------------
[2013-05-12 19:23:27] daliuskal at gmail dot com
Description:
------------
date_default_timezone_set('UTC') is not working as expected, date function
returns
time with -14400 seconds (-4 hours) from UTC.
I've run into this problem after moving into new server, had to set default
timezone to GMT instead of UTC for the code to work correctly.
Test script:
---------------
$time = time();
date_default_timezone_set('UTC');
echo (date('h', $time) - gmdate('h', $time));
date_default_timezone_set('GMT');
echo "\n".(date('h', $time) - gmdate('h', $time));
Expected result:
----------------
0
0
Actual result:
--------------
-4
0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64824&edit=1