This article is a mirror article of machine translation, please click here to jump to the original article.

View: 19862|Reply: 0

[ASP.NET] asp.net mvc json time/date(xx) conversion (one)

[Copy link]
Posted on 6/30/2017 1:33:11 PM | | | |


This is the JSON string after the object is serialized, and we see that the time in the string is in the format \/Date(XXXXX),

It looks very annoying, although the front desk js can convert it to the format of the year, month, day, time, minute and second we need, but, because, I don't want to use js to change,

Jquery formats /Date(1356969600000)/ into the time format of the year, month, day
http://www.itsvse.com/thread-2373-1-1.html
(Source: Architect)

I want to go directly from the background, what should I do???

Of course, rewrite JsonResult, the code is as follows:

Inherit from JsonResult, and then rewrite the ExecuteResult method as follows:
//
        Summary:
        Enables the processing of the results of the operation method by inheriting a custom type from the System.Web.Mvc.ActionResult class.
        //
        Parameters:
        //   context:
        The context in which the results are executed.
        //
        Anomaly:
        //   T:System.ArgumentNullException:
        context parameter is null.
        public override void ExecuteResult(ControllerContext context);

Then, we create a new object, inherit the Controller class, and define a method as follows:



Haha, 90% done, how to use it????

The code is as follows:

Screenshot of success




Previous:【Absolute Protection against Ransomware】Computer company Ghost Windows 7 32-bit, 64-bit ultimate version v201707
Next:asp.net mvc json Time/Date(xx) Conversion (2)
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com