I\'ve been searching for 4 hours now, and have not found a solution to get the difference between two dates in years, months, and days in JavaScript, like: 10th of April 201
I used this simple code to get difference in Years, Months, days with current date.
var sdt = new Date('1972-11-30'); var difdt = new Date(new Date() - sdt); alert((difdt.toISOString().slice(0, 4) - 1970) + "Y " + (difdt.getMonth()+1) + "M " + difdt.getDate() + "D");