#38392 [Opn->Bgs]: date() return result that is different from mysql's now()

From: Date: Wed, 09 Aug 2006 06:55:08 +0000
Subject: #38392 [Opn->Bgs]: date() return result that is different from mysql's now()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-100564@lists.php.net to get a copy of this message
ID: 38392 Updated by: derick@php.net Reported By: pcdinh at gmail dot com -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Windows XP SP2 PHP Version: 5.1.4 New Comment: Use the correct timezone setting. Set date.timezone in php.ini according to one of the names from http://www.php.net/manual/en/timezones.php Previous Comments: ------------------------------------------------------------------------ [2006-08-09 05:12:57] pcdinh at gmail dot com Description: ------------ PHP 5.1.4 and PHP 5.2 RC2 dev return different time compared with mysql's now() and local time. Default config Reproduce code: --------------- Local server in PC: MySql 5.0.22, PHP 5.1.4, PHP 5.2 RC2 dev, PHP 4.4.1 PHP 5.1 and 5.2 echo date("h:i:s"); // return 01:06:49 echo date("h:i:s", time()); // return 01:06:49 PHP 4.4.1 echo date("h:i:s"); // return 12:06:49 echo date("h:i:s", time()); // return 12:06:49 MYSQL (5.0.22) Query: select now(); // return 2006-08-09 12:06:49 Local time: 12:06:49 Expected result: ---------------- PHP 5.1 and 5.2 echo date("h:i:s"); // return 01:06:49 (expected 12:06:49) echo date("h:i:s", time()); // return 01:06:49 (expected 12:06:49) PHP 4.4.1 echo date("h:i:s"); // return 12:06:49 (expected 12:06:49) echo date("h:i:s", time()); // return 12:06:49 (expected 12:06:49) MYSQL (5.0.22) Query: select now(); // return 2006-08-09 12:06:49 ((expected 12:06:49)) Local time: 12:06:49 Actual result: -------------- PHp 5 automatically add 1 hour to the actual time on the local server. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38392&edit=1

« previous php.bugs (#100564) next »