1 //转换json格式时间的方法 如Date(1340239979000)转换为正常 2 function ConvertJSONDateToJSDateObject(JSONDateString) { 3 var date = new Date(parseInt(JSONDateString.replace("/Date(", "").replace(")/", ""), 10)); 4 var year = date.getFullYear(); 5 var month = date.getMonth + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1; 6 var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate(); 7 var hour = date.getHours(); 8 var minute = date.getMinutes(); 9 var second = date.getSeconds(); 10 var datastr = year + "-" + month + "-" + currentDate + " " + hour + ":" + minute + ":" + second; 11 return datastr; 12 }
时间: 2024-10-14 22:34:02