engelsystem/includes/view/Shifts_view.php
Robert Oehlmann c4039f72bb Fixed shift duration calculation
Fixes issue 
2014-11-03 19:28:43 +01:00

11 lines
307 B
PHP

<?php
/**
* Calc shift length in format 12:23h.
* @param Shift $shift
*/
function shift_length($shift) {
$length = floor(($shift['end'] - $shift['start']) / (60 * 60)) . ":";
$length .= str_pad((($shift['end'] - $shift['start']) % (60 * 60)) / 60, 2, "0", STR_PAD_LEFT) . "h";
return $length;
}
?>