Home » Date and Time » Date » Bug #969
Dates created from a string don't set properties correctly
Details
| Submitted | 2004-03-08 05:30 UTC |
|---|---|
| From | redbeard at mdjohnson dot us |
| Assigned | pajoye |
| Status | Closed |
| Package | Date |
| PHP Version | Irrelevant |
| 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