summaryrefslogtreecommitdiff
path: root/includes/view/Shifts_view.php
blob: d0e7d809f16dadfb26a9b5c5fb81c29ef1d962bf (plain)
1
2
3
4
5
6
7
8
9
10
11
<?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;
}
?>