Math, asked by rinkubhunia3614, 1 year ago

How to find years between 2 dates formula in jquery

Answers

Answered by rishika79
0

Answer:

Step-by-step explanation:

Something like this would return an array with the years

function getYears(from, to) {

var d1 = new Date(from),

d2 = new Date(to),

yr = [];

for (var i=d1.getFullYear(); i<=d2.getFullYear(); i++) {

yr.push( i );

}

return yr;

}

Hope it helps you....

Similar questions