Count down to EST Hour everyday?

浪子不回头ぞ 提交于 2019-12-12 04:24:09

问题


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.


回答1:


I'm not sure if you have heard, but there's this trillion dollar site called google.com. You can search terms that will give you the best results on the web! Try it sometime, hella useful.

Check it out, here's the first result from it!

http://www.tripwiremagazine.com/2011/04/9-cool-jquery-countdown-scripts.html




回答2:


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);


来源:https://stackoverflow.com/questions/5953065/count-down-to-est-hour-everyday

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!