Bug #67838 [NEW]: DateTime return with microsecond in default
| From: | lukyrys at gmail dot com | Date: | Thu, 14 Aug 2014 02:04:43 +0000 |
| Subject: | Bug #67838 [NEW]: DateTime return with microsecond in default | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-187105@lists.php.net to get a copy of this message | ||
From: lukyrys at gmail dot com
Operating system: Debian 7.5
PHP version: 5.5.15
Package: Date/time related
Bug Type: Bug
Bug description:DateTime return with microsecond in default
Description:
------------
Why microseconds? Is there any option to disable it? Its new at 5.5.14.
# - https://bugs.php.net/bug.php?id=67646
Test script:
---------------
<?php
error_reporting(E_ALL);
$x = new DateTime('now');
$y = new DateTime($x->format('d.m.Y'));
$y->format("Y-m-d H:i:s");
$d = unserialize(serialize($x));
var_dump($d);
var_dump( unserialize(serialize ($y)) );
Expected result:
----------------
object(DateTime)#3 (3) {
["date"]=>
string(26) "2014-07-18 04:20:50"
["timezone_type"]=>
int(3)
["timezone"]=>
string(13) "Europe/Prague"
}
object(DateTime)#4 (3) {
["date"]=>
string(26) "2014-07-18 00:00:00"
["timezone_type"]=>
int(3)
["timezone"]=>
string(13) "Europe/Prague"
}
Actual result:
--------------
object(DateTime)#3 (3) {
["date"]=>
string(26) "2014-07-18 04:20:50.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(13) "Europe/Prague"
}
object(DateTime)#4 (3) {
["date"]=>
string(26) "2014-07-18 00:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(13) "Europe/Prague"
}
--
Edit bug report at https://bugs.php.net/bug.php?id=67838&edit=1
--