note 29806 added to function.microtime
| From: | nostril at rack1 dot php dot net | Date: | Tue, 25 Feb 2003 18:11:49 +0000 |
| Subject: | note 29806 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44511@lists.php.net to get a copy of this message | ||
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!
--
http://www.php.net/manual/en/function.microtime.php
http://master.php.net/manage/user-notes.php?action=edit+29806
http://master.php.net/manage/user-notes.php?action=delete+29806
http://master.php.net/manage/user-notes.php?action=reject+29806