This topic is locked

minutes to HH:mm total

6/27/2024 4:51:17 AM
PHPRunner General questions
ffrinai author

hi,
i have a field Differenza pura Minuti that contains minutes value and a want a report that convert ninutes in hh:mm in the coloumn H_m
i use CONCAT(FLOOR(presenza.Differenza pura Minuti / 60), ' : ', LPAD(MOD(presenza.Differenza pura Minuti, 60), 2, '0'), ' m') AS H_m
ant it works fine for the single row of the report:
minutes h_m
138 2 : 18 m
120 2 : 00 m


258 4

138 minutes is converted in 2 : 18 m (1 hour and 18 minutes)
120 minutes is converted in 2 : 00 m (2 hour and 00 minutes)
but the SUM for field H_m value in the report is 4 for 258 minutes and not 4: 18 m.
is there a way to have 4 : 18 m in the total for coluoumn h_m?
thanks
Fabio

Sergey Kornilov admin 6/27/2024

You can have a better luck performing this conversion in PHP code, via 'View as' Custom. This way it will be applied to the total as well.

ffrinai author 7/4/2024

in custom view of the field containing the minutes I entered:
$oldv=$value." > ";
$hours = floor($value / 60);
$minutes = $value % 60;
$value=$oldv.sprintf('%02d:%02d', $hours, $minutes);

and the result is
138 > 02:18 for 138 minutes
120 > 02:00 for 120 minutes and so on

in this way I have the two values in absolute minutes and in hours : minutes

in this case I have the same formatting of the value for the detail and for the total, is there a way to differentiate the custom view of the detail from that of the total ?

Fabio