I need to retrieve the current time in milliseconds since the midnight of the current day.
I've found some solutions such this:
Code: Select all
$m = explode(' ',microtime());
return array($m, (int)round($m*1000,3));
list($totalSeconds, $extraMilliseconds) = timeAndMilliseconds();
echo date("H:i:s", $totalSeconds) . ".$extraMilliseconds\n";
It retrive me something like 12:36:13.383
At this point is easy to calculate che milliseconds...
But i want to know if exist an simplest way to do this with few passages..
I know the microtime() function, but according to the official documentation, it retrieve me the number of milliseconds elapsed since the Unix epoch (0:00:00 January 1, 1970 GMT).. while i need milliseconds since the midnight of current day.
In actionscript 3 i've already done something of genere, calculating first the microtime respect to current time, and after the microtime respect to midnight of current day. The difference between the two is the number that i searching for..
I've to do something like this in php too?