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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC