php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67838 DateTime return with microsecond in default
Submitted: 2014-08-14 02:04 UTC Modified: 2014-08-19 17:13 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: lukyrys at gmail dot com Assigned:
Status: Duplicate Package: Date/time related
PHP Version: 5.5.14 OS: Debian 7.5
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lukyrys at gmail dot com
New email:
PHP Version: OS:

 

 [2014-08-14 02:04 UTC] lukyrys at gmail dot com
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"
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-08-19 17:12 UTC] requinix@php.net
-Status: Open +Status: Duplicate -PHP Version: 5.5.15 +PHP Version: 5.5.14
 [2014-08-19 17:12 UTC] requinix@php.net
Duplicate of bug #67838; this came first but the other has been assigned
 [2014-08-19 17:13 UTC] requinix@php.net
Not a duplicate of itself D:
* bug #67866
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 19:01:29 2024 UTC