note 91361 added to function.date
| From: | Anonymous at osu1 dot php dot net | Date: | Mon, 08 Jun 2009 12:59:33 +0000 |
| Subject: | note 91361 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-156469@lists.php.net to get a copy of this message | ||
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"
?>
----
Server IP: 190.54.16.132
Probable Submitter: 201.246.80.61
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/91361
Del: integrated -- https://master.php.net/note/delete/91361/integrated
Del: useless -- https://master.php.net/note/delete/91361/useless
Del: bad code -- https://master.php.net/note/delete/91361/bad+code
Del: spam -- https://master.php.net/note/delete/91361/spam
Del: non-english -- https://master.php.net/note/delete/91361/non-english
Del: in docs -- https://master.php.net/note/delete/91361/in+docs
Del: other reasons-- https://master.php.net/note/delete/91361
Reject -- https://master.php.net/note/reject/91361
Search -- https://master.php.net/manage/user-notes.php