分享 2014-11-13 14:48考虑恢复123 | 浏览 1710 次
php 输出时间。格式为:“时:分:秒.毫秒”,例如:19:37:05.380,要用什么函数?怎么实现?
我有更好的答案
2014-11-13 14:58网友采纳
1 2 3 4 5 6 7 8 9 10 11 12 13 | <?phpfunction udate($format = 'u', $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');?> |
输出:2014-11-13 14:58:23.136105