且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JSON解析的DateTime Android的中

更新时间:2023-01-17 21:07:11

好吧,我希望你找到这个有用的:

Well I hope that you find this usefull:

String ackwardDate = "/Date(1376841597000)/";
//Dirty convertion
Calendar calendar = Calendar.getInstance();
String ackwardRipOff = ackwardDate.replace("/Date(", "").replace(")/", "");
Long timeInMillis = Long.valueOf(ackwardRipOff);
calendar.setTimeInMillis(timeInMillis);
System.out.println(calendar.getTime().toGMTString()); //Prints 18 Aug 2013 15:59:57 GMT

但我说,在你的JSON日期格式这真是ackwards,采取的谷歌,对于正确,STANDAR,解析JSON。

But I'm saying, that date format in your JSON It's really ackwards, take the example of google, for a correct, standar, parsed JSON.