07/04/2018 - PHP
I decided to add this very very simple post to demonstrate how we can get the current time in microseconds, milliseconds and nanoseconds then converting them back to current time again.
// MILLISECONDS
$currentMilliSecond = (int) (microtime(true) * 1000);
echo 'CUR MILLISECONDS:'.$currentMilliSecond.PHP_EOL;
echo 'DATE:'.date('d/m/Y H:i:s', intval($currentMilliSecond/1000)).PHP_EOL;
// MICROSECONDS
$currentMicroSecond = (int) (microtime(true) * 1000000);
echo 'CUR MICROSECONDS:'.$currentMicroSecond.PHP_EOL;
echo 'DATE:'.date('d/m/Y H:i:s', intval($currentMicroSecond/1000000)).PHP_EOL;
// NANOSECONDS
$currentNanoSecond = (int) (microtime(true) * 1000000000);
echo 'CUR NANOSECONDS:'.$currentNanoSecond.PHP_EOL;
echo 'DATE:'.date('d/m/Y H:i:s', intval($currentNanoSecond/1000000000)).PHP_EOL;
CUR MILLISECONDS:1523390684112
DATE:10/04/2018 16:04:44
CUR MICROSECONDS:1523390684112993
DATE:10/04/2018 16:04:44
CUR NANOSECONDS:1523390684113001984
DATE:10/04/2018 16:04:44