I want to change the date for of data which is in format 2016-10-15 to d-m-yy format in jquery as 15-10-2016.I tried and console the output it shows 2016-10-15.I caught this result in jquery ajax page which is fetched from database.
$.each(req,function(i,item){
    var val=$.format.date(req[i].from_date, "dd/MMM/yyyy");
    console.log(val);   //'2016-10-15'
});
                You can do this work use native javascript functions. Use .split() to split date by - delimiter into array and invert array using .reverse() and convert array to sting using .join()
var date = "2016-10-15";
date = date.split("-").reverse().join("-");
console.log(date);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With