This simple code make difference between server-time and a time created by $ora,$minuti,$secondi,$mese,$giorno,$anno (all in unix time)
$finetime=mktime($ora,$minuti,$secondi,$mese,$giorno,$anno);
echo "<br>DF=$finetime<br>";
$differenza=$finetime-$datatime;
$prova=date("Y-m-d H:i:s",$finetime)-date("Y-m-d H:i:s",time());
echo "<br>PROVA=$prova<br>";
echo "<br>DIFFERENZA=$differenza<br>";
$giornirimasti=intval($differenza/86400);
$d1=$differenza-($giornirimasti86400);
$orerimaste=intval($d1/3600);
$d2=$d1-($orerimaste3600);
$minutirimasti=intval($d2/60);
$d3=$d2-($minutirimasti*60);
$secondirimasti=$d3;
$temporimasto="";
if ($giornirimasti!=0)
{
$temporimasto=$giornirimasti." giorni, ";
$temporimasto.=$orerimaste." ore+";
}
else
{
if ($orerimaste!=0)
{
$temporimasto.=$orerimaste." ore,";
$temporimasto.=$minutirimasti." min.+";
}
else
{
$temporimasto.=$minutirimasti." min.";
$temporimasto.=$secondirimasti." sec.";
}
}
The best way if u need to output a difference between two local time is to make a javascript program passing the two number in unix time ,this help to use minor cpu server using the client computer!!!!