ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
~~~ /** * Function dataformat * 时间转换(将秒转换为时间) * @param $n INT时间 */ function dataformat($n) { $hours = floor($n/3600); $minite = floor($n%3600/60); $secend = floor($n%3600%60); $minite = $minite < 10 ? "0".$minite : $minite; $secend = $secend < 10 ? "0".$secend : $secend; if($n >= 3600){ return $hours."时".$minite."分".$secend."秒"; }else{ return "0时".$minite."分".$secend."秒"; } } ~~~ ~~~ /** * 获取秒数对应的时间 * @param int $second * @return array */ function secondConversionArray($second = 0) { $d = floor($second / (3600 * 24)); $h = floor(($second % (3600 * 24)) / 3600); $m = floor((($second % (3600 * 24)) % 3600) / 60); $s = floor((($second % (3600 * 24)) % 3600) % 60); $newtime = [ 'day' => $d, 'hour' => $h, 'minute' => $m, 'second' => $s ]; return $newtime; } ~~~