I have form like this

HTML Code:
<form name"form1">
<input type="text" name="year1" id="year1" /> 
<select name="status" >
<option value="year">add year</option>
<option value="month">add month</option>		
 <input type="text" name="year2" id="year2" /> </form>
i want to add date at the first textfield(year1)at format"Y-m-d" and when choose from dropdown menu add year or month
and display it at the second(year2) in the same format"Y-m-d"
any help?