MVC5中返回json时间

定义一个基控制器

  public class BaseController : Controller
    {
        // GET: admin/Base

        protected ContentResult JsonDate(object Data)
        {
            var timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" };

            return Content(JsonConvert.SerializeObject(Data, Formatting.Indented, timeConverter));
        }

    }

返回的时候使用JsonDate

 

posted @ 2017-11-10 17:38  fy___~  阅读(78)  评论(0)    收藏  举报