#45545 [Asn->Csd]: DateInterval has a limitation of 4 chars for ISO durations
ID: 45545
Updated by: derick@php.net
Reported By: tj at systisoft dot com
-Status: Assigned
+Status: Closed
Bug Type: Date/time related
Operating System: All
PHP Version: 5.3CVS-2008-07-17 (CVS)
Assigned To: derick
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2008-08-02 11:05:50] derick@php.net
This is a bug, as it's clearly specified in ISO 8601.
------------------------------------------------------------------------
[2008-07-18 09:13:01] tj at systisoft dot com
Also
php -r '$d = new DateTime("2005-03-15 12:22:29-0000"); $d->add("36000
seconds"); var_dump($d->format(DATE_ISO8601));'
gives to me:
PHP Warning: DateTime::add() expects parameter 1 to be DateInterval,
string given in Command line code on line 1
Warning: DateTime::add() expects parameter 1 to be DateInterval, string
given in Command line code on line 1
So I don't think this is a solution for now.
------------------------------------------------------------------------
[2008-07-18 09:07:28] tj at systisoft dot com
Ok, that is a solution.
Since I am somewhat new to PHP all this numbers to strings stuff is a
bit disquietingly for me :).
------------------------------------------------------------------------
[2008-07-18 08:30:03] derick@php.net
You can also just do:
$dateTime->add("718231 seconds");
------------------------------------------------------------------------
[2008-07-18 08:19:47] tj at systisoft dot com
I forgot: At least max int would be nice as limit because then
everywhere you get a duration as int you don't have to care about the
limit of the DateInterval constructor.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/45545
--
Edit this bug report at http://bugs.php.net/?id=45545&edit=1
Thread (10 messages)