Home > Article > Backend Development > ASP.NET Core returns Json DateTime format
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>
References:
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!