我有一些PHP脚本,它回显了事件之前还剩多少时间。时间以看起来像23h 15m 4s
这是我的PHP代码:
$now = new DateTime();
$future_date = new DateTime($res['post_time']); # post_time is the time of event
$interval = $future_date->diff($now);
$time_until = rtrim(sprintf("%s%s%s",
$interval->h > 0 ? $interval->h . "h " : "",
$interval->i > 0 ? $interval->i . "m " : "",
$interval->s > 0 ? $interval->s . "s " : ""
)
); # Format time to not have '0'
echo "Time until event " . $time_until;
有没有办法在Javascript中每秒更新一次?我想,回声看起来像
echo "Time until event <span id='countdown'>" . $time_until . "</span>";
JS将使用#countdown
做什么?
答案 0 :(得分:2)
您需要做的是:
itertools.combinations
。geometry
答案 1 :(得分:0)