Bug #52577 [NEW]: Incorrect date returning
From:
Operating system: Windows
PHP version: 5.3.3
Package: Date/time related
Bug Type: Bug
Bug description:Incorrect date returning
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 bug report at http://bugs.php.net/bug.php?id=52577&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52577&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52577&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52577&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52577&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52577&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52577&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52577&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52577&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52577&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52577&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52577&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52577&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52577&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52577&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52577&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52577&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52577&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52577&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52577&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52577&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52577&r=mysqlcfg
Thread (6 messages)
- vadimx at gmail dot com