php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38392 date() return result that is different from mysql's now()
Submitted: 2006-08-09 05:12 UTC Modified: 2006-08-09 06:55 UTC
From: pcdinh at gmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.1.4 OS: Windows XP SP2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: pcdinh at gmail dot com
New email:
PHP Version: OS:

 

 [2006-08-09 05:12 UTC] 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-09 06:55 UTC] derick@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 24 10:01:32 2024 UTC