asp.net core 3.1 webapi interface parameters have time to get any type of problem worthy

asp.net core 3.1 webapi project parameters into the class's reference time format, default follows:

"book_date": "2020-03-25T08:17:45.457Z",

If we pass this
"book_date": "2020-03-25 08:17:45.457",

 

Interface where you fail to get the value. 
According to " ASP.NET 3.1 Core official document http://www.zyiz.net/xilie-293.html " description, it should not be on the field to match.
Solutions:

We use the jon resolution is Newtonsoft.Json
add a code ConfigureServices method StartUp classes in:
// http://www.zyiz.net/xilie-293.html 

 services.AddMvc (Options => 
            { 
                IF (! Env.IsDevelopment ()) 
                { 
                } 
            }) 
                .AddNewtonsoftJson (Options => 
            { 
                // Set the Time Format 
                = options.SerializerSettings.DateFormatString " YYYY the mM-dd-HH: mm: SS " ; 
            })

 

That is .AddNewtonsoftJson method.


Guess you like

Origin www.cnblogs.com/puzi0315/p/12567210.html