I am trying to use jquery/js code that has the user select there birth month then calculate to the next birth month (from today)? I am new to javascript and can not figure out this date stuff.. I keep getting a invalid date error I want the user to select a month and it to subtract from now().. to figure out how many months are left until there next birthday. Not worrying about days or years just dealing with months.. Any suggestions?
get to the next birth month (from today)?
<select name="month1" id="month1" onchange="date()" size="1">
<option value="0">January</option>
<option value="1">February</option>
<option value="2">March</option>
<option value="3">April</option>
<option value="4">May</option>
<option value="5">June</option>
<option value="6">July</option>
<option value="7">August</option>
<option value="8">September</option>
<option value="9">October</option>
<option value="10">November</option>
<option value="11">December</option>
</select>
<script language="JavaScript">
function date() {
var birthmonth = new Date(month1.value);
var today = new Date();
}
document.write("From "+birthmonth+" to "+today+" is "+datediff(birthmonth,today)+" day(s)<br>");
</script>