ID: 42719
Updated by: [EMAIL PROTECTED]
Reported By: sumorai at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: Mac OS X 10.4.10
PHP Version: 5.2.4
New Comment:
PHP strptime() is just a wrapper for libc's strptime() function ->
there is nothing we can do about it.
Previous Comments:
------------------------------------------------------------------------
[2007-09-20 18:08:14] sumorai at gmail dot com
Description:
------------
strptime() seems to have two problems. First is that it returns the
month - 1 instead of the correct numerical month value. Second is that
it returns "107" for the year instead of "2007" as it should. I tested
this in the latest CVS snapshot also (php5.2-200709201630). Also, for
years prior to 2000, it returns the two-digit year, e.g. 96 instead of
1996 when using the %Y format code, which is supposed to return the
four-digit year.
Reproduce code:
---------------
<?
$tmp = strptime("20/Sep/2007:11:51:15","%d/%b/%Y:%H:%M:%S");
var_dump($tmp);
?>
Expected result:
----------------
array(9) {
["tm_sec"]=>
int(15)
["tm_min"]=>
int(51)
["tm_hour"]=>
int(11)
["tm_mday"]=>
int(20)
["tm_mon"]=>
int(9)
["tm_year"]=>
int(2007)
["tm_wday"]=>
int(0)
["tm_yday"]=>
int(0)
["unparsed"]=>
string(0) ""
}
Actual result:
--------------
array(9) {
["tm_sec"]=>
int(15)
["tm_min"]=>
int(51)
["tm_hour"]=>
int(11)
["tm_mday"]=>
int(20)
["tm_mon"]=>
int(8)
["tm_year"]=>
int(107)
["tm_wday"]=>
int(0)
["tm_yday"]=>
int(0)
["unparsed"]=>
string(0) ""
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42719&edit=1