PHP Json格式化时间处理

/*
 * 格式化Json时间  Dx -add
 * date='/Date(1464883200000)/'
 * PHP的时间戳是10位的。而json格式化后的时间戳是13位的。0补位。
 */
function renderTime($date) {
    $dates=str_replace("/Date(", "",$date);
    $dates=str_replace(")/", "", $dates);
    $newdate=substr($dates,0,strlen($dates)-3);
    return $newdate;
}
//记录下这弱智的瞬间!

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章