php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67993 wrong day addition
Submitted: 2014-09-10 08:24 UTC Modified: 2018-09-30 14:04 UTC
Votes:2
Avg. Score:2.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: luke at woollysheep dot net Assigned: cmb (profile)
Status: Duplicate Package: Date/time related
PHP Version: 5.6.0 OS: Slackware
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: luke at woollysheep dot net
New email:
PHP Version: OS:

 

 [2014-09-10 08:24 UTC] luke at woollysheep dot net
Description:
------------
adding P1D to 2369-12-30 00:00:00 the result is 2370-01-00
really strange day :oD

Test script:
---------------
---
From manual page: http://www.php.net/datetime.add
---

$a = new DateTime("2369-12-30 00:00:00");
$a->add(new DateInterval('P1D'));
var_dump($a);

will print

class DateTime#3 (3) {
  public $date =>
  string(26) "2370-01-00 00:00:00.000000"
  public $timezone_type =>
  int(3)
  public $timezone =>
  string(11) "Europe/Rome"
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-09-10 13:58 UTC] luke at woollysheep dot net
-Summary: wrong day addiction +Summary: wrong day addition
 [2014-09-10 13:58 UTC] luke at woollysheep dot net
some correction
 [2014-09-10 14:03 UTC] derick@php.net
-Assigned To: +Assigned To: derick
 [2015-03-09 15:38 UTC] nd dot wortel at gmail dot com
There seems to be a bug with DateTime objects for December 31st, every 400 years starting 2369. See https://bugs.php.net/bug.php?id=69205
 [2017-10-24 08:13 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: derick +Assigned To:
 [2018-09-30 14:04 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2018-09-30 14:04 UTC] cmb@php.net
Closing as duplicate of bug #69205.  See also <https://3v4l.org/0GAPu>.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC