Categories > TinyButStrong general >

Minutes to Hours

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Jim
Date: 2003-09-22
Time: 12:10

Minutes to Hours

Hi

Just a question about how to convert a certain amount of minutes to elapsed hours (format hh:mm) in a easy way.

Like 768 min is 12 hours and 48 min.

768/60 gives Hours (12,8)
768 mod 60 gives minutes 48

But is there one function that do both in one call?

Regards Jim
By: Skrol29
Date: 2003-09-23
Time: 00:34

Re: Minutes to Hours

Hello Jim,

There is no solution do to this with TBS in one call.
May be with some Php functions.
By: Jim
Date: 2003-09-23
Time: 06:06

Re: Minutes to Hours



Whn using this example below, I want to add total in each grid part, I do a htmlconv=no and add bold text to the total rows, that works but then the format part stops working (frm='0.0')

<td width="80" bgcolor="#F0F0F0">[blk_res.t;block=row;frm='0.0';htmlconv=no]</td>
---------------------------------------------------------------
$result[0] = array("country"=>"X", "tv_c"=>"Y", "tv"=>"361", "t"=>$T361/1000, "lkm"=>$QT361, "th"=>0, "th1"=>0, "h1"=>0, "h"=>0, "teknkaste"=>0, "kaste"=>0) ;
$result[1] = array("country"=>"X", "tv_c"=>"Y", "tv"=>"362", "t"=>$T362/1000, "lkm"=>$QT362, "th"=>$T362/1000/$HT362*60, "th1"=>0, "h1"=>0, "h"=>GetHour($HT362), "teknkaste"=>0, "kaste"=>0) ;
$result[3] = array("country"=>"X", "tv_c"=>"Y", "tv"=>"<B>Total<B>", "t"=>"<B>$TTOTAL</B>", "lkm"=>"<B>$QTTOTAL</B>", "th"=>"<B>0</B>", "th1"=>"<B>0</B>", "h1"=>"<B>0</B>", "h"=>"<B>0</B>", "teknkaste"=>"<B>0</B>", "kaste"=>"<B>0</B>") ;
By: Condutiarii
Date: 2003-09-25
Time: 22:54

Re: Minutes to Hours

Use the 'onformat' parameters like :

<td width="80" bgcolor="#F0F0F0">[blk_res.t;block=row;onformat='elapsedTime';htmlconv=no]</td>

and this function in your php code :

function elapsedTime($NomBloc,&$CurrRec)
{
    $hours = round($CurrRec/60, 0);
    $minutes = $CurrRec mod 60;
    $CurrRec = (string)$hours."H".(string)$minutes   
}
By: Jim
Date: 2003-09-29
Time: 06:35

Re: Minutes to Hours

Hi

Problem is that the database got time stored as

00.00 = 0
00.10 = 10
00.50 = 50
02.00 = 200
13.00 = 1300
23.30 = 2330
23.59 = 2359


Hard to calculate elapsed time in minutes between  50 and 2359

Regards Jim