博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ASP.NET Core 返回 Json DateTime 格式
阅读量:6901 次
发布时间:2019-06-27

本文共 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,如需转载请自行联系原作者

你可能感兴趣的文章