Reading Micro-seconds¶
<?php
echo (new Datetime())->format('u');
print PHP_EOL;
echo microtime(true);
print PHP_EOL;
echo hrtime(true);
print PHP_EOL;
echo date('u');
print PHP_EOL;
There are different ways to access micro seconds in PHP : use the Datetime format of u, which works with Datetime. Or call the microtime() or hrtime() functions, with the true parameter.
But don’t use date(): although it has the same u formatting letter, it never provides it.
See Also¶
PHP Features¶
Last updated: 14 July 2026