Check date on exact time - Javascript Date Operation

Javascript examples for Date Operation:Timestamp

Description

Check date 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()//  w  w w  . j  a v  a2 s  .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