• 欢迎访问小杰博客网站
  • 欢迎访问小杰博客网站哦

php取当时的年月日时分秒毫秒

未分类 小杰 8年前 (2015-04-09) 1821次浏览 已收录 0个评论

/**
 * 取当时的年月日时分秒毫秒:20140808121527000
 */
function get_timestamp() {
$datetime = date(“Y-m-d H:i:s”);
$datetime = preg_replace(‘/\s|:|-/’,”,$datetime);

$microtime = get_millisecond();
$timestamp = $datetime.$microtime;

return $timestamp;
}

function get_millisecond()  
{  
    list($usec, $sec) = explode(” “, microtime());  
    
    $msec=round($usec*1000);  
    if(strlen($msec) == 2) {
    $msec = ‘0’.$msec;
    } else if(strlen($msec) == 1) {
    $msec = ’00’.$msec;
    } else if(strlen($msec) == 0){
    $msec = ‘000’;
    }
    return $msec;  
}  


小杰博客 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:php取当时的年月日时分秒毫秒
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址