ID: 42675
Comment by: jazzattcs at yahoo dot com
Reported By: amykhar at gmail dot com
Status: Assigned
Bug Type: Date/time related
Operating System: Mac OS X
PHP Version: 5.2.4
Assigned To: derick
New Comment:
I'm having the same problem. strtotime("February 31, 2007 18:45:00
GMT")should return FALSE but it just gets converted to March 3. I'm
using PHP 5.2.1 running on Windows.
Previous Comments:
------------------------------------------------------------------------
[2007-09-17 15:10:29] amykhar at gmail dot com
If it is expected behavior, why does it behave differently for numeric
dates? 03/345/2007 returns invalid, as I would expect it to. It seems
counterintuitive to have a function that is widely used to process
user-
entered data doing anything other than validating that the date entered
is an actual date.
------------------------------------------------------------------------
[2007-09-16 15:37:42] [EMAIL PROTECTED]
That is expected behavior. Although I would assume rather just adding 1
month to the date it would add 1 month + remaining # of days.
My expected return value would be: October 15, 1992
------------------------------------------------------------------------
[2007-09-14 21:51:04] amykhar at gmail dot com
Description:
------------
If I enter a date with a text month and an invalid day, it returns as
valid.
Example, September 45, 1992 returns as valid. It THINKS the date is
October 5, 1992.
(The same is true for Sep 45, 1992).
What it seems to do is to get the year correctly, then take the last
digit of the day and then add 1 to the month.
Reproduce code:
---------------
$cdate = strtotime("September 45, 1992");
if(!$cdate){
echo(-1);
exit;
}
else{
echo (date("M d Y",$cdate);
}
Expected result:
----------------
It echo -1.
Actual result:
--------------
It prints out October 5, 1992
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42675&edit=1