js $.renderDateTime = function (jsondate) { var timeStamp = parseInt(jsondate.replace(/\D/igm, "")); timeStamp = timeStamp - 8 * 60 * 60 * 1000; //(本地时间)东八区减去8小时 var date = new Date(timeStamp); var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + "-" + (month < 10 ? "0" + month : month) + "-" + (day < 10 ? "0" + day : day) + " " + (hour < 10 ? "0" + hour : hour) + ":" + (minute < 10 ? "0" + minute : minute) + ":" + (second < 10 ? "0" + second : second); };
转载于:https://juejin.im/post/5caee550e51d456e3b70185b