ID: 45545 Comment by: tj at systisoft dot com Reported By: tj at systisoft dot com Status: Assigned Bug Type: Feature/Change Request Operating System: All PHP Version: 5.3CVS-2008-07-17 (CVS) Assigned To: derick New Comment:
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. Previous Comments: ------------------------------------------------------------------------ [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] [EMAIL PROTECTED] 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. ------------------------------------------------------------------------ [2008-07-18 08:16:43] tj at systisoft dot com Just an example when whis is awkward: I get an offest from a time zone an have to add it to a DateTime. The offset was taken from the time zone via getOffset(). Lets assume the offset is positive (easy test if not). $d->add(new DateInterval('PT' . $offset . 'S'))); will fail once the offset is over 9999 seconds. While it is not really necessary to have the limit removed, it is just awkward for a user that he always has to care about this limit when handling durations he gets from sources he can not control. There will always be a limit you have to take care of but a limit of 9999 seconds is reached very fast, if you get durations in seconds. ------------------------------------------------------------------------ [2008-07-17 17:22:42] [EMAIL PROTECTED] I don't think the limit is really needed - but then again, I also don't think it matters much that you can't have periods of > 1000seconds. ------------------------------------------------------------------------ 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