javascript将C#json序列化的Date对象转换成正常的Date格式

时间:2022-01-29 06:31:45
function ChangeDateFormat(cellval) {
var date = new Date(parseInt(cellval.replace("/Date(", "").replace(")/" + ""), 10));
var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth + 1;
var currentDate = date.getDay() < 10 ? "0" + date.getDay() : date.getDay;
return date.getFullYear() + "-" + month + "-" + currentDate;
}