如何将日期时间差转换为倒计时?

How to convert date-time difference into countdown?

使用这个我可以得到日期和时间差。

$first_date = new DateTime(“2012-11-30 17:03:30”);
$second_date = new DateTime(“2012-12-21 00:00:00”);

$difference = $first_date->diff($second_date);

echo format_interval($difference);

如何将它从静态转换为 运行 作为倒数计时器?

试试这个 jquery 插件

<script type="text/javascript" src="/path/to/jquery.countdown.js"></script>

<script type="text/javascript">
$(function() {
    $('.yourCountdownContainer').countdown({
        date: "June 7, 2087 15:03:26"
    });
});
</script>

表格更多详情enter link description here