本文共 282 字,大约阅读时间需要 1 分钟。
ASP.NET Core 返回 Json 格式的时候,如果返回数据中有DateTime
类型,如何自定义其格式呢?配置如下:
services.AddMvc().AddJsonOptions(opt =>{ opt.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm";});
本文转自田园里的蟋蟀博客园博客,原文链接:http://www.cnblogs.com/xishuai/p/asp-net-core-json-datetime-formatstring.html,如需转载请自行联系原作者