How to get current time in ms in PHP? -
what want time()
,but should accurate in ms:
2010-11-15 21:21:00:987
is possible in php?
function udate($format, $utimestamp = null) { if (is_null($utimestamp)) $utimestamp = microtime(true); $timestamp = floor($utimestamp); $milliseconds = round(($utimestamp - $timestamp) * 1000000); return date(preg_replace('`(?<!\\\\)u`', $milliseconds, $format), $timestamp); } echo udate('y-m-d h:i:s:u'); // 2010-11-15 21:21:00:987
Comments
Post a Comment