一个小玩意计算离下班还有多久
时间:2021-07-01 10:21:17
帮助过:4人阅读
渣技术勿喷
- $friday = strtotime("next Friday 18:00:00");
- $time = time();
- $s = $friday-$time;
- $days = floor($s/24/60/60); //剩余天数
- $hour = floor( ($s-$days*24*60*60)/60/60 ); //剩余小时
- $minute = floor( ($s-$days*24*60*60-$hour*60*60)/60 ); //剩余分钟
- $second = floor($s-$days*24*60*60-$hour*60*60-$minute*60); //剩余秒数
- echo json_encode(array('days'=>$days , 'hour'=>$hour , 'minute'=>$minute , 'second'=>$second ));
- ?>
- 还有多久解放哦
- 离解放还有:天小时分秒
|