public static function format_succinct($time) { $time_arr = Time::seconds_to_dhms($time); $time_str = isset($time_arr["days"]) ? $time_arr["days"] . "d " : ""; $time_str .= isset($time_arr["hours"]) ? $time_arr["hours"] . "h " : ""; $time_str .= isset($time_arr["minutes"]) ? $time_arr["minutes"] . "m " : "0m "; $time_str .= isset($time_arr["seconds"]) ? sprintf('%02d', $time_arr["seconds"]) . "s " : "00s "; return $time_str; }
public static function get_total_length_formatted() { $time_arr = Time::seconds_to_dhms(Sustainer::get_total_length()); $time_str = $time_arr["days"] ? $time_arr["days"] . " days, " : ""; $time_str .= $time_arr["hours"] ? $time_arr["hours"] . " hours, " : ""; $time_str .= $time_arr["minutes"] ? $time_arr["minutes"] . " minutes, " : ""; $time_str .= $time_arr["seconds"] ? sprintf('%02d', $time_arr["seconds"]) . " seconds " : "00s "; return $time_str; }
public function get_length_formatted() { $time_arr = Time::seconds_to_dhms($this->get_length()); $time_str = isset($time_arr["days"]) ? $time_arr["days"] . "d " : ""; $time_str .= isset($time_arr["hours"]) ? $time_arr["hours"] . "h " : ""; $time_str .= isset($time_arr["minutes"]) ? $time_arr["minutes"] . "m " : "0m "; $time_str .= isset($time_arr["seconds"]) ? sprintf('%02d', $time_arr["seconds"]) . "s " : "00s "; return $time_str; }