I have this code
$("#calendar").datepicker({
dateFormat: 'yy-mm-dd',
onSelect: function(dateText, inst) {
$('.selected-date').html(dateText);
}
});
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?
Update # 1
$("#calendar").datepicker({
dateFormat: 'yy-mm-dd',
onSelect: function(dateText, inst) {
var fmt2 = $.datepicker.formatDate("mm-dd-yy", dateText);
$(".selected-date").html(fmt2);
}
});
Update # 2
$("#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);
}
});