Convert Facebook JSON created_time of String format to long format
I'm working on android app and trying to get created_time from facebook JSON. I was successful in that and I got it as 2011-07-14T12:28:52+0000
.
Now this should be converted into long format like 220200202932093
My challenge now is to convert that into long format.
This is because i have planned to get relative time using getRelativeTimeSpanString
in android.
Please help me to convert String formatted time f开发者_StackOverflowrom JSON object to long format
String exampleDateString = "2011-07-14T12:28:52+0000";
try
{
long timeMillis = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss+SSSS")
.parse(exampleDateString)
.getTime();
} catch (Exception e) {
e.printStackTrace();
}
精彩评论