Compare dates - Javascript Date Operation

Javascript examples for Date Operation:Date Compare

Description

Compare dates

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=( function() {//  ww w  .j  ava2s. co  m
var startDate = new Date(),
    endDate,
    delta;
setTimeout(function() {
    endDate = new Date();
    delta = endDate.getTime() - startDate.getTime();
    console.log(delta + ' ms');
}, 1000);
    });

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials