well, if you want precise time, you'd have to use PHP:
<?php
/** A function to automatically compute the time difference **/
function get_difference($end = 0; $start = 0)
{
// Define some usefull intervals (in seconds):
$min = 60;
$hour = $sec*60;
$day = $hour*24;
$week = $day*7;
$year = $week*52;
// Start computation:
$diff = $end-$start; // Generate seconds difference
if($diff==0)
{
// No difference, so start and end must be same!!
return 'No Difference';
}
else
{
$days = floor($diff/$day); // Round down....
$diff = $diff-($day*$days); // Update the time difference
$hours = floor($diff/$hour);
$diff = $diff-($hour*$hours);
$minutes = floor($diff/$min);
$diff = $diff-($min*$minutes);
$seconds = $diff; // Remainder should be less than 60
// We're done computation, return the string:
return $days.' days '.$hours.' hours '.$minutes.' minutes '.$seconds.' seconds difference between '.date('m/d/Y H:i:s', $start).' and '.date('m/d/Y H:i:s');
}
}
$diffs = array();
$query = "SELECT UNIX_TIMESTAMP(startDate) start, UNIX_TIMESTAMP(endDate) end FROM `table`";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
$diffs[] = get_difference($row['end'], $row['start']);
}
foreach($diffs as $dif)
{
echo $dif.'<br>';
}
?>
Something like that.... The function should work (although very limited)....
It shouldn't handle periods spanning midnight (i.e 10 pm - 4 am), but if it does, let me know....