Answers for "php time microtime"

PHP
3

php milliseconds

//Timing executation time of script
$startTime = microtime(true); //get time in micro seconds(1 millionth)
usleep(250); 
$endTime = microtime(true);

echo "milliseconds to execute:". ($endTime-$startTime)*1000;
Posted by: Guest on January-03-2020
1

php microtime to seconds

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;
Posted by: Guest on August-06-2020
-1

time now with milliseconds php

$d = new DateTime();
echo $d->format("Y-m-d H:i:s.v"); // v : Milliseconds
Posted by: Guest on June-12-2020

Browse Popular Code Answers by Language