Actually to get time in millisecond from those Strings you can:
public static long getTimeInMillis(String rawDate){
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'kk:mm:ss.SSS");
try {
Date dateTime = dateFormat.parse(rawDate);
long millis = dateTime.getTime();
return millis;
} catch (Exception e){
e.printStackTrace();
Log.e("DateParser", e.getMessage(), e);
return 0;
}
}
And to convert it to relative time you can:
public static String getTimeDifference(long time) {
if (time < 1000000000000L) {
// if timestamp given in seconds, convert to millis
time *= 1000;
}
long now = System.currentTimeMillis();
if (time > now || time <= 0) {
return null;
}
// TODO: localize
final long diff = now - time;
if (diff < MINUTE_MILLIS) {
return "just now";
} else if (diff < 2 * MINUTE_MILLIS) {
return "a minute ago";
} else if (diff < 50 * MINUTE_MILLIS) {
return diff / MINUTE_MILLIS + " minutes ago";
} else if (diff < 90 * MINUTE_MILLIS) {
return "an hour ago";
} else if (diff < 24 * HOUR_MILLIS) {
return diff / HOUR_MILLIS + " hours ago";
} else if (diff < 48 * HOUR_MILLIS) {
return "yesterday";
} else {
return diff / DAY_MILLIS + " days ago";
}
}
So by calling getTimeDifference(getTimeInMillis(rawDate)) you will have a String showing Relative Time based on Current System Time..