ASP.NET MVC JsonResult Date Format

前端 未结 25 3254
渐次进展
渐次进展 2020-11-21 11:22

I have a controller action that effectively simply returns a JsonResult of my model. So, in my method I have something like the following:

return new JsonRes         


        
25条回答
  •  野的像风
    2020-11-21 11:50

    You can use this method:

    String.prototype.jsonToDate = function(){
        try{
            var date;
            eval(("date = new " + this).replace(/\//g,''));
            return date;
        } 
        catch(e){
            return new Date(0);
        }
    };
    

提交回复
热议问题