Calculating years betwen two dates (one from datepicker)

Calculating years betwen two dates (one from datepicker)

Hi everyone,
I have some problem with calculating "exactly" number of years between two dates (one from string and second from datepicker). I write the code who calculating tstamp from datepicker, but I can't figured out how to write the code who will calculating tstamp from "text" who has right syntax (dd/mm/yy).

here is my code:
  1. <form action="#" method="post">
        <div id="end_date">20/11/2012</div>
        <label for="birthday">to
            <input type="text" name="birthday" id="birthday" />
        </label>
        <label>tstamp1
            <input type="text" name="total_hour1" id="total_hour1" />
        </label>
        <label>tstamp2
            <input type="text" name="total_hour2" id="total_hour2" />
        </label>
    </form>










And my js:

  1. $(function() {
            $( "#birthday" ).datepicker({ dateFormat: 'mm/dd/yy' });
        });

    $('#birthday').change(function() {
        var g = $('#end_date').val();
        var h = $('#birthday').val();
        date1= g.split("/");
        var timestamp = (new Date(date1[2],date1[1] - 1,date1[0]));
        $('#total_hour1').val(timestamp);
        
        date2= h.split("/");
        var timestamp = (new Date(date2[2],date2[1] - 1,date2[0]));
        $('#total_hour2').val(timestamp);
    });













And here is working example on jsfiddle: http://jsfiddle.net/aLa38/

I will be glad for any help.