function format_shift($shift) { list($day, $start, $dash, $stop) = explode(' ', $shift); $day = date_format(swwat_parse_date($day), 'D M j'); $min1 = date_format(swwat_parse_time($start . ":00"), 'i'); if (strcmp($min1, '00')) { $start = date_format(swwat_parse_time($start . ":00"), 'g:i A'); } else { $start = date_format(swwat_parse_time($start . ":00"), 'g A'); } $min2 = date_format(swwat_parse_time($stop . ":00"), 'i'); if (strcmp($min2, '00')) { $stop = date_format(swwat_parse_time($stop . ":00"), 'g:i A'); } else { $stop = date_format(swwat_parse_time($stop . ":00"), 'g A'); } return $day . ', ' . $start . ' - ' . $stop; }
/** * @see formatTimeKey * @return array of string of form '10:00 - 11:00' */ public static function selectTimeSpan($expoId) { try { $rows = self::select(GROSSPREF_SELECT_TIMESPAN, $expoId); $values = array(); foreach ($rows as $row) { $values[] = self::formatTimeSpanKey(swwat_parse_time($row['startTime']), swwat_parse_time($row['stopTime'])); } $rows = NULL; return $values; } catch (PDOException $pe) { logMessage('GrossPreference::selectTime(' . $expoId . ')', $pe->getMessage()); } }