title: JavaScript to change Year displayed based on month/day
body: <p>I'm trying to create a script that if today's date is  before January 16, the current year will print, but if today's date is greater than or equal to January 16, the following year will print. </p>
  
  <p>I am pretty new to coding JavaScript so perhaps I am just missing something stupid. Can anyone help by looking over this code and tell me what I did wrong?</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var today = new Date();
  var mm = today.getMonth()+1; //January is 0! 
  var dd = today.getday();
  if (mm &lt; 10) {
      mm = '0'+mm
  } 
  
  var today = new Date("mm/dd") 
  var other = new Date("01/16")
  
  if (today &lt; other){
  var printDate = theDate.getFullYear();  
  }
  
  else if (today &gt;= other){
  var printDate = theDate.getFullYear()+1;      
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Then in the HTML:</p>
  
  <pre><code>&lt;strong&gt;16 January&lt;/strong&gt; &lt;script&gt;document.write(printDate);&lt;/script&gt;
  </code></pre>
  
  <p>Output right now is "undefined." Any ideas would be greatly appreciated!</p>