I have the following dates as strings..
2016-10-14
2016-10-15
2016-10-16
2016-10-17
2016-10-18
2016-10-19
2016-10-20
How can I dynamically conv
var dates = ['2016-10-14', '2016-10-15', '2016-10-16', '2016-10-17', '2016-10-18', '2016-10-19', '2016-10-20'];
function convertDates(str) {
var d = new Date(str);
var day = d.getDate();
var month = d.toString().split(' ')[1];
return day +' '+ month;
}
var final = [];
dates.map(function(item) {
final.push(convertDates(item));
});
That's it!