Jul 29, 2002 #1 Techieto Programmer Jul 19, 2002 3 0 0 US Is there a date function in Java Script to find months between two dates? Or some user defined funtion to do the same. Thanks.
Is there a date function in Java Script to find months between two dates? Or some user defined funtion to do the same. Thanks.
Jul 30, 2002 #2 trollacious Programmer Sep 29, 2004 4,046 0 0 US If you've already created the Date() objects: function datedifferencemonths(date1, date2) { var months1=date1.getMonth() + (date1.getFullYear() * 12); var months2=date2.getMonth() + (date2.getFullYear() * 12); return Math.abs(months1 - months2); } Upvote 0 Downvote
If you've already created the Date() objects: function datedifferencemonths(date1, date2) { var months1=date1.getMonth() + (date1.getFullYear() * 12); var months2=date2.getMonth() + (date2.getFullYear() * 12); return Math.abs(months1 - months2); }