Bug #74645 [NEW]: DateTime::format() and DateTimeInterval %i %s Leading Zeros and Documentation

From: Date: Wed, 24 May 2017 14:08:27 +0000
Subject: Bug #74645 [NEW]: DateTime::format() and DateTimeInterval %i %s Leading Zeros and Documentation
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209248@lists.php.net to get a copy of this message
From: jimgkraai at gmail dot com Operating system: redhat 2.6.32-696.1.1.el6.x86_64 PHP version: 5.6.30 Package: *General Issues Bug Type: Bug Bug description:DateTime::format() and DateTimeInterval %i %s Leading Zeros and Documentation Description: ------------ --- From manual page: http://www.php.net/datetime.format --- DateTime::format() does not add leading zeros for the %i and %s format characters as documented. https://secure.php.net/manual/en/datetime.format.php "Parameters/format" states "Format accepted by date()." https://secure.php.net/manual/en/datetime.format.php states - "I (capital i) Whether or not the date is in daylight saving time" which is not minutes with leading zero - 'S' is not in the list of format characters The actual behavior of DateTime::format() is not properly documented. Note that similar behavior/documentation dissonance exists for DateTimeInterval::format() Test script: --------------- <?php $time_start = new DateTime('now'); sleep(60*2+3.1415926535897961646); $time_end = new DateTime('now'); $time_interval=$time_end->diff($time_start); echo $time_interval->format("%H:%i:%s seconds") . PHP_EOL; echo $time_interval->format("%H:%I:%S seconds") . PHP_EOL; // <- not documented for DateTime::format() -- Edit bug report at https://bugs.php.net/bug.php?id=74645&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74645&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74645&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74645&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74645&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74645&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74645&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74645&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74645&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74645&r=support Expected behavior: https://bugs.php.net/fix.php?id=74645&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74645&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74645&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74645&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74645&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74645&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74645&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74645&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74645&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74645&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74645&r=mysqlcfg

« previous php.bugs (#209248) next »