php-documentation-list | 2003101

[PHP-DOC] #25598 [Com]: strtotime can't handle dates before 1970, and the documentation doesn't say it. From: thom at ourclubonline dot com (phpdoc <email protected>)
Date: 10/10/03

 ID: 25598
 Comment by: thom at ourclubonline dot com
 Reported By: bens at benjamindsmith dot com
 Status: Open
 Bug Type: Documentation problem
 Operating System: 2.4.x Linux, Windows
 PHP Version: 4.3.2
 New Comment:

Same problem on PHP 4.3.2 on Linux 2.2.1.

Previous Comments:
------------------------------------------------------------------------

[2003-09-22 16:38:30] wjs at sympatico dot ca

works on php 4.3.2, linux 2.4

not on php 4.3.3, linux 2.4 (rh 9.-0)

------------------------------------------------------------------------

[2003-09-18 17:57:42] bens at benjamindsmith dot com

Description:
------------
No matter what I do, strtotime can't seem to handle dates prior to
1970. The answer returned is always -1.

The manual doesn't indicate this fact.

Reproduce code:
---------------
echo phpversion();
echo "\n------------------\n";

$time1="1/1/1970";
$time2="31-dec-1969";
$time3="31-dec-1949";

echo strtotime($time1);
echo "\n";
echo strtotime($time2);
echo "\n";
echo strtotime($time3);
echo "\n";

Expected result:
----------------
4.3.2
-----------------
28800
-{some integer other than 1}
-{some bigger integer other than 1}

Actual result:
--------------
4.3.2
------------------
28800
-1
-1

------------------------------------------------------------------------

-- 
Edit this bug report at http://bugs.php.net/?id=25598&edit=1