MVC 后台处理 json格式的日期

首先创建一个basecontrol,

  protected ContentResult JsonDate(object Data)
        {
            //将json中带时间的数据进行格式处理
            var timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" };
            return Content(JsonConvert.SerializeObject(Data, Formatting.Indented, timeConverter));
        }

return JsonDate(new { draw = draw, recordsTotal = totalcount, recordsFiltered = totalcount, data = pl });         
        

 

 
posted @ 2019-02-26 09:13  老丹点赵  阅读(618)  评论(0编辑  收藏  举报