Bug #52577 [Opn->Asn]: Incorrect date returning
| From: | felipe@php.net | Date: | Tue, 10 Aug 2010 22:44:17 +0000 |
| Subject: | Bug #52577 [Opn->Asn]: Incorrect date returning | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-153317@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52577&edit=1
ID: 52577
Updated by: felipe@php.net
Reported by: vadimx at gmail dot com
Summary: Incorrect date returning
-Status: Open
+Status: Assigned
Type: Bug
Package: Date/time related
Operating System: Windows
PHP Version: 5.3.3
-Assigned To:
+Assigned To: derick
Block user comment: N
New Comment:
What timezone are you using?
Previous Comments:
------------------------------------------------------------------------
[2010-08-10 18:23:41] vadimx at gmail dot com
Description:
------------
When i use unixtime in DateTime object, this returning wrong date, -1
day.
Test script:
---------------
$date = '7.8.2010';
echo "String: ".$date."<br>";
$date_format = 'j.m.Y';
$unixtime = strtotime($date);
echo "Unixtime: ".$unixtime."<br>";
echo "Date(PHP): ".date($date_format,$unixtime)."<br>";
$date = new DateTime('@'.$unixtime);
echo "DateTime(PHP Class): ".$date->format($date_format);
Expected result:
----------------
String: 7.8.2010
Unixtime: 1281128400
Date(PHP): 7.08.2010
DateTime(PHP Class): 7.08.2010
Actual result:
--------------
String: 7.8.2010
Unixtime: 1281128400
Date(PHP): 7.08.2010
DateTime(PHP Class): 6.08.2010
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52577&edit=1