php microtime

88

<?php
$time_start = microtime(true);

// Sleep for a while
usleep(100);

$time_end = microtime(true);
$time = $time_end - $time_start;

echo "Did nothing in $time seconds\n";
?>
echo date("H:i:s",$endtime-$starttime);

$duration = $endtime-$starttime;
$hours = (int)($duration/60/60);
$minutes = (int)($duration/60)-$hours*60;
$seconds = (int)$duration-$hours*60*60-$minutes*60;
$d = new DateTime();
echo $d->format("Y-m-d H:i:s.v"); // v : Milliseconds 

Comments

Submit
0 Comments