javascript - jquery countdown timer starting timer from 2hrs countdown -


i have jquery script countdown showing days, hours, minutes, , seconds.

now want remove days script , should start countdown 2 hours. haven't been able accomplish this.

here's code:

<p id="demo"></p> <script>     // set date we're counting down     var countdowndate = new date("jan 5, 2018 15:37:25").gettime();      // update count down every 1 second     var x = setinterval(function () {          // todays date , time         var = new date().gettime();          // find distance between count down date         var distance = countdowndate - now;          // time calculations days, hours, minutes , seconds         var days = math.floor(distance / (1000 * 60 * 60 * 24));         var hours = math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));         var minutes = math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));         var seconds = math.floor((distance % (1000 * 60)) / 1000);          // display result in element id="demo"         document.getelementbyid("demo").innerhtml = days + "d " + hours + "h "         + minutes + "m " + seconds + "s ";          // if count down finished, write text         if (distance < 0) {             clearinterval(x);             document.getelementbyid("demo").innerhtml = "expired";         }     }, 1000); </script> 


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -