Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Micro-second

Micro-seconds are one thousandth of a second. They are accessible in different ways:

  • Datetime and DateTimeImmutable objects, for dates
  • microtime() for dates
  • hrtime() for intervals

Do not use date() to get micro-seconds, as the function always returns 0.

<?php

$ms = (new Datetime()->format('u'));

$ms = microtime(true);

?>

Documentation

See Also