Import Java. text. parseexception; import Java. text. simpledateformat; import Java. util. calendar; import Java. util. date;/***** @ author robot **/public class test {public static date getdatebystring (string time) {date = NULL; If (time = NULL) return date; string date_format = "yyyy-mm-dd hh: mm: SS"; simpledateformat format = new simpledateformat (date_format); try {date = format. parse (time);} catch (parseexception e) {e. printstacktrace ();} return date;} public static string getprocessing time (string time) {string processing string = NULL; Long Now = calendar. getinstance (). gettimeinmillis (); Date = getdatebystring (time); If (date = NULL) return hour string; long deltime = (now-date. gettime ()/1000; If (deltime> 365*24*60*60) {hour string = (INT) (deltime/(365*24*60*60 )) + "years ago";} else if (deltime> 24*60*60) {hour string = (INT) (deltime/(24*60*60 )) + "Days Ago";} else if (deltime> 60*60) {hour string = (INT) (deltime/(60*60) + "hour ago ";} else if (deltime> 60) {minute string = (INT) (deltime/(60) + "before";} else if (deltime> 1) {second string = deltime + "seconds ago";} else {second string = "1 second ago";} return second string;} public static void main (string [] ARGs) {string time = "10:40:55"; system. out. println (getprocessing time (time ));}}