Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
- function GetCount(){
- var d = new Date();
- var dateFuture = new Date(d.getFullYear(), d.getMonth(), d.getDate(), 16, 00, 00);
- dateNow = new Date(); //grab current date
- amount = dateFuture.getTime() - dateNow.getTime(); //calc milliseconds between dates
- day = "morgen";
- // time is already past
- if(amount < 0){
- dateFuture = new Date(d.getFullYear(), d.getMonth(), (d.getDate()), 23, 59, 59);
- amount = dateFuture.getTime() - dateNow.getTime();
- day = "overmorgen";
- }
- // date is still good
- days=1;hours=0;mins=0;secs=0;out="";
- amount = Math.floor(amount/1000);//kill the "milliseconds" so just secs
- //days=Math.floor(amount/86400);//days
- amount=amount%86400;
- hours=Math.floor(amount/3600);//hours
- amount=amount%3600;
- mins=Math.floor(amount/60);//minutes
- amount=amount%60;
- secs=Math.floor(amount);//seconds
- document.getElementById('countbox').innerHTML=n(hours) + ":" + n(mins)+ ":" + n(secs);
- document.getElementById('countbox-day').innerHTML=day;
- setTimeout("GetCount()", 1000);
- }
- function n(n){
- return n > 9 ? "" + n: "0" + n;
- }
- window.onload=function(){GetCount();}//call when everything has loaded
- //-->
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement