asp.net core 返回 json 格式的时候,如果返回数据中有datetime类型,如何自定义其格式呢?配置如下:
<code class="sourceCode cs">services.<span class="fu">AddMvc</span>().<span class="fu">AddJsonOptions</span>(opt =>
{
opt.<span class="fu">SerializerSettings</span>.<span class="fu">DateFormatString</span> = <span class="st">"yyyy-MM-dd HH:mm"</span>;
});</code>参考资料:
- Json date being serialized to wrong format










