php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76252 Incrementing microseconds work funny
Submitted: 2018-04-23 09:01 UTC Modified: 2018-04-23 09:16 UTC
From: cz dot paranoiq at gmail dot com Assigned:
Status: Duplicate Package: Date/time related
PHP Version: 7.2.4 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cz dot paranoiq at gmail dot com
New email:
PHP Version: OS:

 

 [2018-04-23 09:01 UTC] cz dot paranoiq at gmail dot com
Description:
------------
after adding 1 microsecond to datetime with 999999 microseconds, resulted datetime has the same seconds and 1000000 microseconds :]

see the second dump
https://3v4l.org/ZbGpl

Test script:
---------------
<?php

$d = new \DateTimeImmutable('2000-01-01 23:59:59.999999');
$d2 = $d->modify('+1 microsecond');
var_dump($d);
var_dump($d->format('s.u'));
var_dump($d2);
var_dump($d2->format('s.u'));


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-04-23 09:16 UTC] requinix@php.net
-Status: Open +Status: Duplicate
 [2018-04-23 09:16 UTC] requinix@php.net
Duplicate of bug #75642
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue May 11 06:01:24 2021 UTC