Hi Planetsin
No, I'm using TIME type. I have a script which calculate the diff minutes from to field and then convert the minutes to hours and minutes like this HH:mm. It took me long time to figure out how to do that!!! and this is how it looks like:
$to_time=strtotime("{stime}");
$from_time=strtotime("{etime}");
$total_time=round(abs($to_time - $from_time) / 60,2);
function ConvertMinutes2Hours($Minutes)
{
if ($Minutes < 0)
{
$Min = Abs($Minutes);
}
else
{
$Min = $Minutes;
}
$iHours = Floor($Min / 60);
$Minutes = ($Min - ($iHours * 60)) / 100;
$tHours = $iHours + $Minutes;
if ($Minutes < 0)
{
$tHours = $tHours * (-1);
}
$aHours = explode(".", $tHours);
$iHours = $aHours[0];
if (empty($aHours[1]))
{
$aHours[1] = "00";
}
$Minutes = $aHours[1];
if (strlen($Minutes) < 2)
{
$Minutes = $Minutes ."0";
}
if ($iHours < 10)
{
$iHours = "0" . $iHours;
}
$tHours = $iHours .":". $Minutes;
return $tHours;
}
{total}=ConvertMinutes2Hours($total_time);
I have also found a script that calculates the total time from the db column 'total', but I can't figure out how to insert the result in my detail page, only as a pop up window with ECHO!!!
$query1 = "SELECT SEC_TO_TIME(SUM(TIME_TO_SEC(`total`))) As total FROM `jos_log`";
$result1 = mysql_query($query1);
$row = mysql_fetch_assoc($result1);
echo $row['total'];
Any ideas?