每天倒数到EST小时? [英] Count down to EST Hour everyday?

查看:173
本文介绍了每天倒数到EST小时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我每天将如何计算到特定的时间,例如美国东部标准时间下午12点...,这样它将倒计时1小时56分钟,直到中午12点/午餐?我正在寻找简短的东西,不需要CSS或JS,因为它将是文本,并且仅在刷新页面时更新.

How would i count down to a specific hour every day, say 12PM EST time... So that it would countdown as 1 Hour 56 Minutes until 12PM / Lunch? I'm looking for something short and simple, no need for CSS or JS as it will be text and only update when the page is refreshed.

推荐答案

这就是我一直在寻找的,以防它对其他人有所帮助.

Here's what i was looking for in case it will help someone else.

function countdown($year, $month, $day, $hour, $minute)
{

$the_countdown_date = mktime($hour, $minute, 0, $month, $day, $year, -1);
$current = time();

$difference = $the_countdown_date - $current;
if ($difference < 0) $difference = 0;

$days = floor($difference/60/60/24);
$hours = floor(($difference - $days*60*60*24)/60/60);
$minutes = floor(($difference - $days*60*60*24 - $hours*60*60)/60);

echo "Checkback in ".$hours." hours and ".$minutes." minutes";
}

countdown(2016,1,1,12,0);

这篇关于每天倒数到EST小时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆