ID: 48609 Updated by: [email protected] Reported By: pierre dot inglebert at insa-rennes dot fr -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Debian Lenny PHP Version: 5.3.0RC4 New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Indeed, they need to be prefixed with %. Previous Comments: ------------------------------------------------------------------------ [2009-12-08 10:44:28] yoarvi at gmail dot com According to the documentation for DateInterval::format (http://us.php.net/manual/en/dateinterval.format.php), the format specifiers need to be prefixed with a %. var_dump($diff->format('%H:%i:%s')); var_dump($diff->format('%Y-%m-%d %H:%i:%s')); produces the expected result. ------------------------------------------------------------------------ [2009-06-19 17:19:19] pierre dot inglebert at insa-rennes dot fr Description: ------------ DateInterval::format method just returns the parameter given. Reproduce code: --------------- <?php $date1 = new DateTime('2009-06-19 20:00:00'); $date2 = new DateTime('2009-06-19 20:00:40'); $diff = $date1->diff($date2,TRUE); print_r($diff); var_dump($diff->format('H:i:s')); var_dump($diff->format('Y-m-d H:i:s')); ?> Expected result: ---------------- DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 40 [invert] => 0 [days] => 0 ) string(5) "00:00:40" string(11) "0000-00-00 00:00:40" Actual result: -------------- DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 40 [invert] => 0 [days] => 0 ) string(5) "H:i:s" string(11) "Y-m-d H:i:s" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48609&edit=1
