如何在Android中解析类似于\/Date(1391802454790-0700)\/
的json日期格式,转换为(01/31/2014 11:44 AM)
。
API结果:
{
"Comment":"ogogog",
"CommentDate":"\/Date(1391802454790-0700)\/",
"CommentReply":[
],
"NumberOfLikes":1,
"UniqueId":"f786e0da-2e4a-430f-a37c-c60db1901e38",
"VideoId":65
}
我尝试了下面的代码,但是没有显示出这种格式 (01/31/2014 11:44 AM)。
String json = "\/Date(1391802454790-0700)\/";
//String json = "commentReplyCommentDate";
json=json.replace("/Date(", "").replace("-0700)/", "");
long time = Long.parseLong(json);
Date d= new Date(time);
System.out.println("Dateeee---->"+d);