|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-08-09 06:55 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 13 18:00:01 2025 UTC |
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.