date validation to check whether it exceeds exactly next year's date - Javascript Date Operation

Javascript examples for Date Operation:Year

Description

date validation to check whether it exceeds exactly next year's date

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.  ja va  2s  .co m*/
var toDayDate = new Date();
var enteredDate = new Date('06/09/2018');      // mm/dd/yyyy formate
if(toDayDate.getTime()<enteredDate.getTime() && toDayDate.getTime()+(365*24*60*60*1000) > enteredDate.getTime()){
    console.log("hi");
}
    }

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

Related Tutorials