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 #354

No support for microseconds in dates

Details

Submitted2003-12-04 15:11 UTC
Frommike dot carter at personalmedicaladvisor dot co dot uk
Assignedpajoye
StatusClosed
PackageDate
PHP Version4.3.3
OSRedhat 9
Roadmaps(Not assigned)

Comments

[2003-12-04 15:11 UTC] mike dot carter at personalmedicaladvisor dot co dot uk

Description:
------------
There is no setDate() support for the default Microsoft XML date format which includes microseconds.

This is mostly apparent when using SOAP and recieving a date/time from a .Net server - the timestamp arrives in the format "2003-12-03T00:00:00.0000000-00:00".

The closest format defined in Date.php class is the 'DATE_FORMAT_ISO_EXTENDED' - apart from the .0000000

I am not sure what "standard" this is but it would be good to allow support for it in the next Date class release?

Reproduce code:
---------------
<?php
include 'Date.php';
$d = "2003-12-03T00:00:00.0000000-00:00";
$dateObj = new Date();
$dateObj->setDate($d, DATE_FORMAT_ISO_EXTENDED);
echo $dateObj->getMonth();
?>

Expected result:
----------------
12

Actual result:
--------------
1

This is because the date passed in initially is not being parsed correctly so defaults to 1-1-1970

[2004-05-16 13:01 UTC] paj at pearfr dot org

This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.

In case this was a pear.php.net website problem, the change will show
up on the website in short time.

Thank you for the report, and for helping us make PEAR better.

http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/#dateTime