I was playing little with jQuery UI datePicker, and Moment.js library, and here you can see result of it. Also, that source can be used for jQuery UI development, since I extracted only necessary files.
In my example most important are these two lines of code:
var $myDate = $( "#datepicker" ).datepicker( "getDate" ); var $formatedMyDate = moment($myDate).format('YYYY-MM-DD hh:mm');
As you can see with line:
Date $myDate, I am formating to format YYYY-MM-DD hh:mm