Validating Date Range - Javascript Date Operation

Javascript examples for Date Operation:Date Validate

Description

Validating Date Range

Demo Code

ResultView the demo in separate window

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

var date1 = new Date("05/23/2013").getTime(),
    date2 = new Date("05/29/2013").getTime(),
    myDate = new Date("05/25/2013").getTime();

if (myDate >= date1 && myDate <= date2) {
    document.write("true");
}

      </script>  
   </body>/*  ww w . j a va  2s. co m*/
</html>

Related Tutorials