calculate age Problem

calculate age Problem

Hi,

I have the following date and I am trying to calculate the age of the person but I am always getting ZERO.

Ca you help please...

  1. <script type='text/javascript'>
  2. $(function() {
  3. var toDate = $("#dateBirthday").datepicker({
  4. defaultDate: "+1w",
  5. dateFormat: 'dd-M-yy',
  6. changeMonth: true,
  7. numberOfMonths: 1,
  8. onSelect: function(selectedDate)
  9. {
  10. var start = new Date();
  11. var end   = $('#dateBirthday').datepicker('getDate');
  12. var days   = (end - start)/1000/60/60/24;
  13. if (days < 0) $("#lblAge").text(0); else $("#lblTotal").text(days+1);
  14. }
  15. });
  16. });
  17. </script>