I am using jqxDateTimeInput for date time picker. The current date format is in dd/mm/yyyy. I want to change it to dd-MMM-yyyy. Can someone please tell me how to do this?
The following is the jqx code:
<script type="text/javascript">
$(document).ready(function () {
// create jqxcalendar.
$("#jqxWidget").jqxDateTimeInput({ width: 250, height: 25, selectionMode: 'range' });
$("#jqxWidget").on('change', function (event) {
var selection = $("#jqxWidget").jqxDateTimeInput('getRange');
if (selection.from != null) {
$("#selection").html("<div>From: " + selection.from.toLocaleDateString() + " <br/>To: " + selection.to.toLocaleDateString() + "</div>");
}
});
var date1 = new Date();
date1.setFullYear(2013, 7, 7);
var date2 = new Date();
date2.setFullYear(2013, 7, 15);
$("#jqxWidget").jqxDateTimeInput('setRange', date1, date2);
});
</script>
calling the function:
<div id='jqxWidget'></div>
<div style='margin-top: 10px; font-size: 13px; font-family: Verdana;' id='selection'></div>
In the second div where id = selection, I want to display the format as '12-Jan-2013' ie in the format 'dd-MMM-yyyy'