代码示例:(标识:demo_php_date8)
<!DOCTYPE html>
<html>
<body>

<?php
$d1=strtotime("December 31");
$d2=ceil(($d1-time())/60/60/24);
echo "距离十二月三十一日还有:" . $d2 ." 天。";
?>

</body>
</html>
运行结果: