-function time_to_decimal($a) {
- $tmp = explode(":", $a);
- if($tmp[1]{0}=="0") $tmp[1] = $tmp[1]{1};
+// time_to_decimal converts a time string such as 1:15 to its decimal representation such as 1.25 or 1,25.
+function time_to_decimal($val) {
+ global $user;
+ $parts = explode(':', $val); // parts[0] is hours, parts[1] is minutes.
+
+ $minutePercent = round($parts[1]*100/60); // Integer value (0-98) of percent of minutes portion in the hour.
+ if($minutePercent < 10) $minutePercent = '0'.$minutePercent; // Pad small values with a 0 to always have 2 digits.