Jquery UI datePicker <p>I have this code</p> <pre><code>$("#calendar").datepicker({ dateFormat: 'yy-mm-dd', onSelect: function(dateText, inst) { $('.selected-date').html(dateText); } }); </code></pre> <p>I am looking for a way to send the date in 1 format to the database with ajax(not shown) and also update a div with a different date format. What is the best way to do this?</p> <p><strong>Update # 1</strong></p> <pre><code>$("#calendar").datepicker({ dateFormat: 'yy-mm-dd', onSelect: function(dateText, inst) { var fmt2 = $.datepicker.formatDate("mm-dd-yy", dateText); $(".selected-date").html(fmt2); } }); </code></pre> <p><strong>Update # 2</strong></p> <pre><code>$("#calendar").datepicker({ dateFormat: 'yy-mm-dd', onSelect: function(dateText, inst) { var d = new Date(dateText); var fmt2 = $.datepicker.formatDate("DD, d MM, yy", d); $(".selected-date").html(fmt2); } }); </code></pre>