取得当天结束的其他时间 [英] Get different time to end of the current day
本文介绍了取得当天结束的其他时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好时光。
如何获得不同的时间来结束一天?
例如,当我运行PHP脚本时,我希望得到以下输出:
Good time.
How can i Get different time to end of the current day?
For example i would like get this output when i run my PHP script:
19 hours 35 minutes 13 seconds to end of current day
谢谢
推荐答案
希望这对您有所帮助。
Try this code snippet here
echo remainingTime();
function remainingTime()
{
$string="";
$date= date("Y-m-d H:i:s");
$endDate= date("Y-m-d")." 23:59:59";
$remainingSeconds=strtotime($endDate)-strtotime($date);
$string.=gmdate("H", $remainingSeconds)." hours ";
$string.=gmdate("i", $remainingSeconds)." minutes ";
$string.=gmdate("s", $remainingSeconds)." seconds to the end of current day";
return $string;
}
这篇关于取得当天结束的其他时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文