/*** Convert the timestamp into a string that represents "How long before" * @ Param timestr timestamp * @ return */public static string getstandarddate (string timestr) {stringbuffer sb = new stringbuffer (); long T = long. parselong (timestr); long time = system. currenttimemillis ()-(T * 1000); long mill = (long) math. ceil (Time/1000); // long minute = (long) math before the second. ceil (Time/60/1000 running f); // minutes ago long hour = (long) math. ceil (Time/60/60/1000.0f); // hour long Day = (long) math. ceil (Time/24/60/60/1000 then f); // If (day-1> 0) {sb. append (day + "day");} else if (hour-1> 0) {If (hour> = 24) {sb. append ("1 day");} else {sb. append (hour + "Hour") ;}} else if (minute-1> 0) {If (minute = 60) {sb. append ("1 hour");} else {sb. append (minute + "min") ;}} else if (mill-1> 0) {If (Mill = 60) {sb. append ("1 minute");} else {sb. append (Mill + "seconds") ;}} else {SB. append ("just");} If (! SB. tostring (). Equals ("just") {sb. append ("before");} return sb. tostring ();}
The timestamp is converted into a string that represents "How long before"