Public feed #603324

Unnamed

public text v1 · immutable
Raw Edit
·published 2007-07-04 18:27 UTC
rendered paste body
	if (!function_exists("TimeAgo")) {
		function TimeAgo($timestamp){
			$difference = time() - $timestamp;
			$periods = array("second", "minute", "hour", "day", "week", "month", "years", "decade");
			$lengths = array("60","60","24","7","4.35","12","10");
			for($j = 0; $difference >= $lengths[$j]; $j++)
			$difference /= $lengths[$j];
			$difference = round($difference);
			if($difference != 1) $periods[$j].= "s";
			$text = "$difference $periods[$j]";
			return $text;
		}
	}