ASP.NET Core returns Json DateTime format

PHP中文网
Release: 2017-06-17 16:27:56
Original
2238 people have browsed it

When

ASP.NET Core returns Json format, if the returned data contains the DateTime type, how to customize its format? The configuration is as follows:

<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>
Copy after login

References:

  • Json date being serialized to wrong format

The above is the detailed content of ASP.NET Core returns Json DateTime format. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!