PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Date and Time » Date » Bug #969

Dates created from a string don't set properties correctly

Details

Submitted2004-03-08 05:30 UTC
Fromredbeard at mdjohnson dot us
Assignedpajoye
StatusClosed
PackageDate
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2004-03-08 05:30 UTC] redbeard at mdjohnson dot us

Description:
------------
When creating a date from a string, the various properties (year, month, day, etc) are set to strings instead of integers. This results in calls to the access methods (e.g. getDay()) to return strings, which can result in incorrect output.

Reproduce code:
---------------
$d = new Date('2004-01-01');
echo $d->getDay();

Expected result:
----------------
1

Actual result:
--------------
01