<body>
<div id="date"></div>
</body>
<script type="text/javascript">
function getTime () {
var now = new Date();
var future = new Date("01/01/2018 00:00:00");
var time = future.getTime() - now.getTime();
var days = parseInt(time/1000/60/60/24);
var hours = parseInt(time/1000/60/60%24);
var minutes = parseInt(time/1000/60%60);
var seconds = parseInt(time/1000%60);
document.getElementById("date").innerHTML = days + "天"+ hours + "时" + minutes + "分" + seconds + "秒";
}
setInterval(getTime,1000);
</script>