Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #date #difference #months
ADD COMMENT
Topic
Name
8+5 =