start script on exact time - Javascript Date Operation

Javascript examples for Date Operation:Minute

Description

start script on exact time

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script type="text/javascript">
            var startDate = new Date("2018-06-14 12:47");
            window.setInterval(checkDate, 1000);
            function checkDate()/*from   w  w w  .j  a v  a 2s .  c  o m*/
            {
                if (new Date() > startDate)
                    myDate.value = new Date().toLocaleString(); //or do your alert ;)
            }
        
      </script> 
   </head> 
   <body> 
      <input type="text" id="myDate" style="width: 200px">  
   </body>
</html>

Related Tutorials