sql >> Base de Datos >  >> RDS >> Mysql

cómo calcular el tiempo dedicado a mi aplicación por marca de tiempo

Podrías calcular esto usando la función timeDiff:

times = array();

foreach ($result as $row){
    // convert to unix timestamps
    $firstTime=strtotime($firstTime);
    $lastTime=strtotime($lastTime);

    // perform subtraction to get the difference (in seconds) between times
    $timeDiff=$lastTime-$firstTime;
    $times[] = $timeDiff;
    echo(secondsToTime($timeDiff));
    # 18 days, 23 hours, 41 minutes and 7 seconds
}

echo(secondsToTime(array_sum($times)));
#total of all times