I am trying to convert a date (obtained from a datepicker field) in DD-MM-YYYY to DD/MM/YYYY and get the difference (in years) between the two..
I have tried this so far
Try to make two Date- Objects like this
var date1 = new Date(2010, 6, 17);
var date2 = new Date(2013, 12, 18);
var diff = new Date(date2.getTime() - date1.getTime());
console.log(diff.getUTCFullYear() - 1970); // Gives difference as year
// 3
console.log(diff.getUTCMonth()); // Gives month count of difference
// 6
console.log(diff.getUTCDate() - 1); // Gives day count of difference
// 4