In some Weibo systems, time stamp-friendly formatting functions often display the time before the current time, for example: just five seconds ago, five hours ago, five days ago ..
/***** Description friendly display time * @ param int $ time the timestamp to be formatted defaults to the current time * @ return string $ text formatted timestamp * @ author yijianqing * /function mdate ($ time = NULL) {$ text = ''; $ time = NULL | $ time> time ()? Time (): intval ($ time); $ t = time ()-$ time; // time difference (seconds) if ($ t = 0) $ text = 'hangzhou'; elseif ($ t <60) $ text = $ t. 'seconds ago '; // elseif ($ t <60*60) $ text = floor ($ t/60) within one minute ). 'minute ago '; // elseif ($ t <60*60*24) $ text = floor ($ t/(60*60) within an hour )). 'hour ago '; // elseif ($ t <60*60*24*3) in a day $ text = floor ($ time/(60*60*24 )) = 1? 'Yesterday '. date ('H: I ', $ time): 'Day before day '. date ('H: I ', $ time); // yesterday and the day before yesterday elseif ($ t <60*60*24*30) $ text = date ('m Month D day H: I ', $ time); // elseif ($ t <60*60*24*365) in a month) $ text = date ('mddday', $ time); // else $ text = date ('y, m dday', $ time) within a year ); // return $ text a year ago ;}