jQuery頁面時間輸出爲1528942855757

html+="<td>"+getMyDate(student.createDate)+"</td>";

function getMyDate(str){  
    var oDate = new Date(str),  
    oYear = oDate.getFullYear(),  
    oMonth = oDate.getMonth()+1,  
    oDay = oDate.getDate(),  
    oHour = oDate.getHours(),  
    oMin = oDate.getMinutes(),  
    oSen = oDate.getSeconds(),  
    oTime = oYear +'-'+ getzf(oMonth) +'-'+ getzf(oDay)+' '+oHour+':'+oMin+':'+oSen;//最後拼接時間  
    return oTime;  
}; 
//補0操作
function getzf(num){  
    if(parseInt(num) < 10){  
      num = '0'+num;  
    }  
    return num;  
}

 

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