What is the “right” JSON date format?

前端 未结 16 1586
执念已碎
执念已碎 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 15:54

    If you are using Kotlin then this will solve your problem. (MS Json format)

    val dataString = "/Date(1586583441106)/"
    val date = Date(Long.parseLong(dataString.substring(6, dataString.length - 2)))
    

提交回复
热议问题