.NET MVC JsonResult return time format Js call formatting problems

       Encountered a problem record it with MVC .NET, call the background data at Ajax, when returned if there is time data, Js is to get this data:

/Date(1568702878193)/

       Such results are displayed clearly not what we want, so it needs to deal with this data, Js as follows:

//json时间格式化
function convertTime(jsonTime, format) {
    var date = new Date(parseInt(jsonTime.replace("/Date(", "").replace(")/", ""), 10));
    var formatDate = date.format(format);
    return formatDate;
}

       Call about this method of displaying data in place, you can put the data into a format the right.

Published 109 original articles · won praise 42 · views 570 000 +

Guess you like

Origin blog.csdn.net/sinat_28984567/article/details/100927332