note 29806 deleted from function.microtime by didou
| From: | didou@php.net | Date: | Mon, 29 Dec 2003 15:20:03 +0000 |
| Subject: | note 29806 deleted from function.microtime by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-62634@lists.php.net to get a copy of this message | ||
Note Submitter: nostril
----
I desperately searched for a way to get the current time as<br> milliseconds in PHP (in JAVA
this is no problem).
microtime() only returns the seconds
-> 1046196198
Finally I solved my problem in a pretty simple way
function currentTimeMillis()
{
list($usec, $sec) = explode(" ",microtime());
return ($sec . substr($usec, 2, 3));
}
Now you have values like this:
-> 1046196198890
3 more digits for the milliseconds. Too bad PHP doesn't support this!