Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Gibt die Differenz zwischen zwei (Datum und Uhrzeit) PHP zurück

Try this
function getTimes($t1, $t2)
{
$timeFirst  = strtotime($t1);
$timeSecond = strtotime($t2);
$differenceInSeconds = $timeSecond - $timeFirst;
$h=0;
$m  = floor($differenceInSeconds / 60);
$s  = $differenceInSeconds % 60;
if ($m>=60)
{
  $h = floor($m / 60);
  $m = $m % 60;
}
$tim = $h.':'.$m.':'.$s;
return $tim;
}
it will return difference time in hours:min:sec