I am using datepicker to select dates from a calendar and it all works fine. However, the dates are given in numbered format when I alert them: Eg: 5-4-2017
How can I get the month in wording instead? Eg: 5-Apr-2017
The jquery looks like this:
$("#txtTo").datepicker({
numberOfMonths: 1,
onSelect: function(selected) {
txtToDate = selected;
var dt = new Date(selected);
dt.setDate(dt.getDate() - 1);
$("#txtFrom").datepicker("option", "maxDate", dt);
}
});
and I used this to get the dates:
var date1 = $("#txtFrom").datepicker('getDate'),
day_1 = date1.getDate(),
month_1 = date1.getMonth() + 1,
year_1 = date1.getFullYear();
How can I get the month in a different format?
Hope you can help and here is my pen if needed