PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Date and Time » Date » Bug #4878

DATE_FORMAT_ISO_EXTENDED_MICROTIME not padding seconds correctly

Details

Submitted2005-07-22 04:44 UTC
Fromaashley at optimiser dot com
Assignedpajoye
StatusClosed
PackageDate
PHP Version5.0.4
OSLinux
Roadmaps(Not assigned)

Comments

[2005-07-22 04:44 UTC] aashley at optimiser dot com

Description:
------------
When outputing a date in DATE_FORMAT_ISO_EXTENDED_MICROTIME if seconds < 10 then the seconds are not correctly zero padded.

This means when feeding the output back into a new PEAR Date it is unable to parse the date in correctly.

A patch to fix this is at http://frood.cernun.net/stuff/Date.php-correct-microtime-output.patch

Test script:
---------------
$date = new Date('2005-07-22 12:30:01.000500');

print $date->getDate(DATE_FORMAT_ISO_EXTENDED_MICROTIME);

Expected result:
----------------
2005-07-22T12:21:01.000500

Actual result:
--------------
2005-07-22T12:21:1.000500