Hi,
To calculate the number of days between timestamps I've divided the difference by 86400 (secs in a day). I've seen this recomended in other posts. The timestamps have all been created with mktime using 0,0,1 for Hour, min, secs.
Certain months give non integers as answers and then it corrects itself once it is past that month. The code below will reproduce this behavior. $calcval is the correct number of days between stamps (it takes the ceil of the calculation) $calcval2 shows the weird values.
Any idea what causes this?
Thanks!
$loopstamp=mktime(0,0,1,DATE("n"),DATE("d"),DATE("Y"));
$first_loop=$loopstamp;
for ($i=0; $i<700 ; $i++)
{
$calcval=ceil(($loopstamp-$first_loop)/86400);
$calcval2=($loopstamp-$first_loop)/86400;
echo DATE("Y-m-d H:i:s",$loopstamp) . ' and ' . $calcval . ' and ' . $calcval2 . '<br>';
$loopstamp=mktime(0,0,1,DATE("n"),DATE("d")+$i,DATE("Y"));
}