note 51998 rejected from function.strtotime by nlopess
| From: | nlopess@php.net | Date: | Mon, 18 Apr 2005 14:14:18 +0000 |
| Subject: | note 51998 rejected from function.strtotime by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-88163@lists.php.net to get a copy of this message | ||
Note Submitter: russel at sunraystudios dot com
----
I noticed a funny bug, I think :>)
It seems that in version php == 4.3.2 when you use
strtotime("$date + 1 day");
It ends up adding 18 hours, instead of 24 hours. You can get around
this by changing the above code fragment to:
strtotime("$date + 1 day 6 hours");
==
This for() loop shows the unexpected behaviour in php 4.3.2:
<?php
$date = date("Y-m-d G:i:s", strtotime("today"));
for($index = 0; $index < 99; $index++){
$date = date("Y-m-d G:i:s", strtotime("$date +1 day"));
echo "$date<br />\n";
}
?>
Works perfectly (adds one day) on php 4.3.10, and 5.0.2 that I have
on other servers, just not the 4.3.2. Wanted it noted here.
==
russel@sunraystudios.com