时间戳转化成X天X小时X分X秒
//自定义函数(调用时输入实参$second)
function time2string($second){
$day = floor($second/(3600*24));
$second = $second%(3600*24);
$hour = floor($second/3600);
$second = $second%3600;
$minute = floor($second/60);
$second = $second%60;
// 不用管怎么实现的,能用就ok
return $day.’天’.$hour.’小时’.$minute.’分’.$second.’秒’;
}
获取从现在到2018年1月1日1点1分1秒还有多久
$time1 = strtotime(‘2018-1-1 1:1:1’);
$time2 = strtotime(now);//相减得到相差的 秒 数
$time3 = $time1 – $time2;//输出
echo ‘从现在到2018年1月1日1点1分1秒还有:’.time2string($time3);
原文链接:https://blog.csdn.net/qq_39599062/article/details/80882543
浏览量: 8