note 93891 deleted from function.date by peehaa
| From: | peehaa@php.net | Date: | Fri, 06 Jan 2017 15:59:04 +0000 |
| Subject: | note 93891 deleted from function.date by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208720@lists.php.net to get a copy of this message | ||
Note Submitter: Edward Rudd
----
To actually make use ot the "u" (microsecond) you need to use the DateTime object and not
the date() function.
For example
<?php
$t = microtime(true);
$micro = sprintf("%06d",($t - floor($t)) * 1000000);
$d = new DateTime( date('Y-m-d H:i:s.'.$micro,$t) );
print $d->format("Y-m-d H:i:s.u");
?>