首页 > 技术文章 > MVC 后台处理 json格式的日期

daniel-niu 2019-02-26 09:13 原文

首先创建一个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 });         
        

 

 

推荐阅读