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

Incorrect timestamps allowd

Details

Request #9700Incorrect timestamps allowd
Submitted2006-12-26 21:30 UTC
Fromseb dot anselment at gmx dot de
Assignedc01234
StatusClosed
PackageDate
PHP Version4.3.10
OSDebian
Roadmaps(Not assigned)

Comments

[2006-12-26 21:30 UTC] seb dot anselment at gmx dot de

Description:
------------
Hi,

I really love this package but I found a very strange behavior when passing a not existing timestamp like f.ex. 20060132T163315 (month is 32) to the Date constructor. Surely this makes no sense but it's so easy to set a correct date (like mktime does).
You can see the test script beyond these lines. I found nothing in one of the 88 reports matching this topic.

Now decide yourselves if this is a bug report or feature request ;)

I wish you all a merry Christmas and a happy new year! Continue your great work.

Yours,
Seb

Test script:
---------------
$timestamp = "20060132T163315";
$d = new Date($timestamp);
echo $d->getDate(DATE_FORMAT_ISO_BASIC);

//I solved this by using:
$timestamp = "20060132T163315";
$d = new Date($timestamp);
$d->addSpan(new Date_Span("0,0,0,0"));
echo $d->getDate(DATE_FORMAT_ISO_BASIC);

Expected result:
----------------
2006-02-01 16:33:15

Actual result:
--------------
2006-01-32 16:33:15