1 function jsonDateFormat(jsonDate) { //json日期格式转换为正常格式 2 try { 3 var date = new Date(parseInt(jsonDate.replace("/Date(", "").replace(")/", ""), 10)); 4 var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1; 5 var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate(); 6 var hours = date.getHours(); 7 var minutes = date.getMinutes(); 8 var seconds = date.getSeconds(); 9 var milliseconds = date.getMilliseconds();10 return date.getFullYear() + "-" + month + "-" + day;11 //+ " " + hours + ":" + minutes + ":" + seconds + "." + milliseconds;12 } catch (ex) {13 return "";14 }15 }
出自http://www.cnblogs.com/ahjesus