//yyyy-MM-dd HH:mm:SS function JsonDateToDate(jsondate) { var date = new Date(parseInt(jsondate.replace("/Date(", "").replace(")/", ""), 10)); var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hh = date.getHours(); var mm = date.getMinutes(); var ss = date.getSeconds(); return year + "-" + month + "-" + day + " " + hh + ":" + mm + ":" + ss; } var date = "/Date(1379944571737)/"; alert(JsonDateToDate(date));
1 //yyyy-MM-dd HH:mm:SS 2 function JsonDateToDate(jsondate) { 3 var date = new Date(parseInt(jsondate.replace("/Date(", "").replace(")/", ""), 10)); 4 var year = date.getFullYear(); 5 var month = date.getMonth() + 1; 6 var day = date.getDate(); 7 var hh = date.getHours(); 8 var mm = date.getMinutes(); 9 var ss = date.getSeconds(); 10 return year + "-" + month + "-" + day + " " + hh + ":" + mm + ":" + ss; 11 } 12 var date = "/Date(1379944571737)/"; 13 alert(JsonDateToDate(date));
代码
结果为:2013-09-23 21:56:11
时间: 2024-10-15 17:30:42