What is the “right” JSON date format?

前端 未结 16 1357
执念已碎
执念已碎 2020-11-21 15:14

I\'ve seen so many different standards for the JSON date format:

\"\\\"\\\\/Date(1335205592410)\\\\/\\\"\"         .NET JavaScriptSerializer
\"\\\"\\\\/Date(         


        
16条回答
  •  梦如初夏
    2020-11-21 16:04

    The following code has worked for me. This code will print date in DD-MM-YYYY format.

    DateValue=DateValue.substring(6,8)+"-"+DateValue.substring(4,6)+"-"+DateValue.substring(0,4);
    

    else, you can also use:

    DateValue=DateValue.substring(0,4)+"-"+DateValue.substring(4,6)+"-"+DateValue.substring(6,8);
    

提交回复
热议问题