Get current year and next year - Javascript Date Operation

Javascript examples for Date Operation:Year

Description

Get current year and next year

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <select id="MySelectBox"> 
         <option value="1" id="this_year"></option> 
         <option value="2" id="next_year"></option> 
      </select> 
      <script type="text/javascript">
var d = new Date();//from   w ww .j  a  v  a2s . co m
var x = document.getElementById("this_year");
x.innerHTML=d.getFullYear();
var y = document.getElementById("next_year");
y.innerHTML=d.getFullYear()+1;

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

Related Tutorials