javascript - How to get a month in different format in jquery -
this question has answer here:
- how change date format in javascript [duplicate] 5 answers
- how format javascript date 36 answers
i using datepicker select dates calendar , works fine. however, dates given in numbered format when alert them: eg: 5-4-2017
how can month in wording instead? eg: 5-apr-2017
the jquery looks 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 used dates:
var date1 = $("#txtfrom").datepicker('getdate'), day_1 = date1.getdate(), month_1 = date1.getmonth() + 1, year_1 = date1.getfullyear();
how can month in different format?
hope can , here pen if needed
Comments
Post a Comment