php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73628 DateTime not able to handle DateInterval on february
Submitted: 2016-11-30 14:21 UTC Modified: 2016-12-11 04:22 UTC
From: etienne dot chabert at gmail dot com Assigned:
Status: No Feedback Package: Date/time related
PHP Version: 7.0.13 OS: OSX
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
24 + 24 = ?
Subscribe to this entry?

 
 [2016-11-30 14:21 UTC] etienne dot chabert at gmail dot com
Description:
------------
You should execute : (new DateTime("2016-11-30"))->add(new DateInterval("P3M"))

Result -> 2017-03-02

Then execute : (new DateTime("2016-12-01"))->add(new DateInterval("P3M"))

Result -> 2017-03-01



Test script:
---------------
if ((new DateTime("2016-11-30"))->add(new DateInterval("P3M")) > (new DateTime("2016-12-01"))->add(new DateInterval("P3M")))
  throw new Exception("WTF");
echo "You fixed it";


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-30 16:46 UTC] cmb@php.net
-Status: Open +Status: Feedback -Package: date_time +Package: Date/time related
 [2016-11-30 16:46 UTC] cmb@php.net
Please state what you expect both expressions to yield!
 [2016-12-11 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 01:01:30 2024 UTC