Hmmm... I am totally missing something about bcdiv(). I'm working with unix timestamps and keep getting a fatal "Call to undefined function: bcdiv()
This is the Code....
Function DateDiff ($interval, $date1,$date2) {
// get the number of seconds between the two dates
$timedifference = $date2 - $date1;
switch ($interval) {
case "w":
$retval = bcdiv($timedifference ,604800);
break;
case "d":
$retval = bcdiv($timedifference,86400);
break;
case "h":
$retval = bcdiv($timedifference,3600);
break;
case "n":
$retval = bcdiv($timedifference,60);
break;
case "s":
$retval = $timedifference;
break;
}
return $retval;
}
$currenttime = time();
echo "Current time: ". strftime("%Hh%M %A %d %b" ,$currenttime)."<br>";
$newtime = DateAdd ("n",50 ,$currenttime);
echo "Time plus 50 minutes: ". strftime("%Hh%M %A %d %b" ,$newtime)."<br>";
$temptime = DateDiff ("n",$currenttime ,$newtime);
echo "Interval between two times: ".$temptime;
Results in
Fatal error: Call to undefined function: bcdiv() in /home/sonic/public_html/datediff.inc on line 19
What am I missing????