I am using the UI DatePicker from jQuery UI as the stand alone picker. I have this code:
And the
getDate function returns a JavaScript date. Use the following code to format this date:
var dateObject = $("#datepicker").datepicker("getDate");
var dateString = $.datepicker.formatDate("dd-mm-yy", dateObject);
It uses a utility function which is built into datepicker:
$.datepicker.formatDate( format, date, settings )
- Format a date into a string value with a specified format.
The full list of format specifiers is available here.