diff options
author | Philip Häusler <msquare@notrademark.de> | 2013-09-18 01:38:36 +0200 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2013-09-18 01:38:36 +0200 |
commit | bfb0cacd541cc20129a3c0ac77130370741dca18 (patch) | |
tree | 0a0e86e1a53d712065664c12d06603bc044df9ec /includes/view/Shifts_view.php | |
parent | d50cc21f50cb3ec3afdabb74a20d81bd1a53dfbd (diff) |
mysql to mysqli and a lot of cleanup and mvc
Diffstat (limited to 'includes/view/Shifts_view.php')
-rw-r--r-- | includes/view/Shifts_view.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/includes/view/Shifts_view.php b/includes/view/Shifts_view.php new file mode 100644 index 00000000..824f519a --- /dev/null +++ b/includes/view/Shifts_view.php @@ -0,0 +1,11 @@ +<?php +/** + * Calc shift length in format 12:23h. + * @param Shift $shift + */ +function shift_length($shift) { + $length = round(($shift['end'] - $shift['start']) / (60 * 60), 0) . ":"; + $length .= str_pad((($shift['end'] - $shift['start']) % (60 * 60)) / 60, 2, "0", STR_PAD_LEFT) . "h"; + return $length; +} +?>
\ No newline at end of file |