本文整理汇总了PHP中Time::seconds_to_dhms方法的典型用法代码示例。如果您正苦于以下问题:PHP Time::seconds_to_dhms方法的具体用法?PHP Time::seconds_to_dhms怎么用?PHP Time::seconds_to_dhms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Time
的用法示例。
在下文中一共展示了Time::seconds_to_dhms方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format_succinct
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;
}
示例2: get_total_length_formatted
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;
}
示例3: get_length_formatted
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;
}