jQuery Date Picker Input Date Format

http://stackoverflow.com/questions/11104933/jquery-date-picker-input-date-format

by Rayon Dabre

HTML

<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.21/themes/base/jquery-ui.css">
<input type="text" id="closedate" size='50'>

JavaScript

$(document).ready(function() {
  $("#closedate").datepicker({
    dateFormat: 'DD, d MM, yy',
    onSelect: function(a, b) {
      var diff = new Date() - $(this).datepicker("getDate");
      diff = Math.floor(diff / (1000 * 60 * 60 * 24) * -1) + 1;
      var value = a + '(' + diff + ' days)'
      $(this).val(value);
    }
  });
});