note 91361 deleted from function.date by danbrown
| From: | danbrown@php.net | Date: | Mon, 08 Jun 2009 13:25:05 +0000 |
| Subject: | note 91361 deleted from function.date by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156472@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Hello
I cannot understand why the date() command does not have an option to display milliseconds?
Can this be added in a future PHP version?
I wrote a function which displays the current time with milliseconds.
If you want more than 3 digits after the decimal point simply change the "4" in substr()
<?php
$Stamp = microtime(); // $Stamp= "0.31262723 1244046329"
list($Frac, $Sec) = explode(" ", $Stamp); // $Frac = "0.31262723"
$Time = date("H:i:s", $Sec). substr($Frac,1,4); // $Time = "17:09:12.312"
?>