note 59410 deleted from function.strtotime by derick
| From: | derick@php.net | Date: | Sun, 15 Jul 2007 12:44:48 +0000 |
| Subject: | note 59410 deleted from function.strtotime by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-128567@lists.php.net to get a copy of this message | ||
Note Submitter: j dot parree at team-networks dot de
----
In PHP 4.3.10(Suse Linux 9.2) strtotime() seems to sometimes resolve incorrect month values.
e.g.:
<?
$day = strftime ("%d", strtotime("-$day days"));
$month = strftime ("%m", strtotime("-$day days"));
$year = strftime ("%Y", strtotime("-$day days"));
?>
Result: $month is sometimes: expected month-1
php.net bug-reporting systems says: "problem will be fixed in php5 not any londer in
php4!".
Workarround in php4 to savely get the correct values for example above:
<?
$date = strftime ("%d.%m.%Y", strtotime("-$day days"));
list($day, $month, $year) = split('[/.]', $date);
?>