我想得到的是非常喜欢time(),但应该是毫秒准确:
2010-11-15 21:21:00:987
Run Code Online (Sandbox Code Playgroud)
这可能在PHP?
小智 10
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
Run Code Online (Sandbox Code Playgroud)
使用microtime并将其转换为毫秒:
$millitime = round(microtime(true) * 1000);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
28221 次 |
| 最近记录: |