How to parse .net DateTime received as json string into java's Date object

后端 未结 5 2196
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-09 22:57

I\'m receiving .NET\'s DateTime object as json string through my asmx webservice and trying to parse it with help of gson library. But seems like there\'s no su

5条回答
  •  星月不相逢
    2020-12-09 23:44

    Dont Know...I had tryed all above.. but didn't work for me. finally I have come with this solution :)

    when you get string from json object string will get like : "/Date(1373543393598+0200)/". but if You will see on result string which is comming from server will look like this: {"respDateTime":"/Date(1373267484478+0200)/"}

    String json = "/Date(1373543393598+0200)/"; 
    json=json.replace("/Date(", "").replace("+0200)/", "");
    long time = Long.parseLong(json);
    Date d= new Date(time); 
    

提交回复
热议问题