I was recently asked how to work out the time difference between two timestamps so I thought i'd post the answer here.

Code:
function time_dif($ts1=0,$ts2=0){
	
	if ($ts1 < $ts2){$temp = $ts1;$ts1 = $ts2;$ts2 = $temp;}
	
	$difference = $ts1 - $ts2;
	
	$seconds = $difference % 60;
	$total_minutes = (int)($difference / 60);
	$minutes = $total_minutes % 60;
	$total_hours = (int)($total_minutes / 60);

	if ($seconds < 10){$seconds = "0".$seconds;}
	if ($minutes < 10){$minutes = "0".$minutes;}
	if ($total_hours < 10){$total_hours = "0".$total_hours;}
	
	return "$total_hours:$minutes:$seconds";
}
you can test it out @ http://www.guntrisoft.com/dev/james/...val2=982985627