Answers for "get months name and year between two dates js"

1

javascript date difference in months

function monthDiff(d1, d2) {
    var months;
    months = (d2.getFullYear() - d1.getFullYear()) * 12;
    months -= d1.getMonth();
    months += d2.getMonth();
    return months <= 0 ? 0 : months;
}
Posted by: Guest on May-27-2020
1

get 5 months after date in javascript

var currentDate = new Date();
var expiryDate = new Date();
expiryDate.setMonth(expiryDate.getMonth() + 3);
console.log(currentDate);
console.log(expiryDate);

//$uj@y
Posted by: Guest on December-14-2021

Code answers related to "get months name and year between two dates js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language