// Convert GMT time to long time public static long getlongbygmt (string gmttime) throws parseexception {simpledateformat GMT = new simpledateformat ("Eee, d Mmm yyyy hh: mm: ss z ", locale. english); Return GMT. parse (gmttime ). gettime () ;}// format the display time public static string displaytime (long timestamp) {simpledateformat MH = new simpledateformat ("mm-dd hh: mm: SS "); simpledateformat Hm = new simpledateformat ("HH: mm: SS"); long currentseconds = system. currenttimemillis (); // The current system time string timestr = NULL; long currentstart = currentseconds-currentseconds % (24*60*60*1000); long timegap = (currentstart-timestamp) /1000; // seconds different from the current early morning time if (timegap <= 0) // Today {timestr = HM. format (timestamp);} else if (timegap> 0 & timegap <= 24*60*60) {timestr = "yesterday" + HM. format (timestamp); // Yesterday} else if (timegap> 24*60*60 & timegap <= 2*24*60*60) {timestr = "the day before yesterday" + HM. format (timestamp); // the day before yesterday} else {timestr = MH. format (timestamp);} return timestr;} // obtain the time value public static string getnormaltime (long value) based on long data) {simpledateformat format = new simpledateformat ("yyyy-mm-dd hh: mm: SS"); string time = format. format (new date (value); return time ;}