Jul 29, 2002 #1 Techieto Programmer Joined Jul 19, 2002 Messages 3 Location 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 Joined Sep 29, 2004 Messages 4,046 Location 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); }