до конца суток осталось
<div class="time"></div>
<script>
var x = 24*60*60*1000; // тоесть сутки
down = document.querySelector('.time'),
end = new Date;
end.setHours(0,0,0);
end -= new Date;
end += x;
function tick(e){
var ost = end - e;
if(ost < 0) {end = ost = x};
var s = Math.floor(ost/1000),
m = Math.floor(s/60),
h = Math.floor(m/60),
d = Math.floor(h/24);
s = s%60+'';
m = m%60+'';
h = h%24+'';
d = d+'';
d = d.length == 1 ? '0'+d:d;
h = h.length == 1 ? '0'+h:h;
m = m.length == 1 ? '0'+m:m;
s = s.length == 1 ? '0'+s:s;
down.innerHTML = d+' дней '+h+' часов '+m+' минут '+s+' секунд';
requestAnimationFrame(tick)
};
requestAnimationFrame(tick)
</script>