Two methods were collected:
From C# Datatime format to Js via Json, the time is displayed as timestamp /Date(1354116249000)/, Js conversion as follows
function GetDateFormat(str) {
return new Date(parseInt(str.substr(6, 13))).toLocaleDateString();
}
GetDateFormat (‘ /Date(1354116249000)/ ‘) — > 2017/1/1
Original text: blog.csdn.net/luckzhang_l…
/date()/ converts to the common time format
function FormatToDate(val) { if (val ! = null) { var date = new Date(parseInt(val.replace("/Date(", "").replace(")/", ""), 10)); Var month = date.getMonth() +1 > 10 var month = date.getMonth() +1 < 10? "0" + (date.getMonth() + 1) : date.getMonth() + 1; var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate(); return date.getFullYear() + "-" + month + "-" + currentDate; } return ""; }Copy the code
Original text: blog.csdn.net/xiaouncle/a…
Welcome to qq group communication: 704028989