From fbc236128e610cfb0bfc74bcf9d0fce17646b796 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 21 Jan 2019 11:16:14 -0500 Subject: [PATCH] add a function to format a time into a duration. Can't use date() because 0 doesn't give us 00:00:00 it gives 19:00:00 --- web/includes/functions.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/includes/functions.php b/web/includes/functions.php index c33de8439..042bec583 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -2446,4 +2446,8 @@ function getAffectedIds( $name ) { return $ids; } +function format_duration($time, $separator=':') { + return sprintf('%02d%s%02d%s%02d', floor($time/3600), $separator, ($time/60)%60, $separator, $time%60); +} + ?>