Date.diff
Library
date.js
Syntax
Date.diff(interval, date1, date2);
Parameters
interval A string that is the interval you want to use to calculate the differences between the two dates.
date1, date2 Two JavaScript Date objects to compare..
Description
Returns the number of intervals between two dates.
Interval
The interval string may be in the following units:
yyyy - Year
q -- Quarter
m -- Month
y -- Day of year
d -- Day
w -- Weekday
ww -- Week of year
h -- Hour
n -- Minute
s -- Second
Examples
The example below will return a value of 9.
var dt1 = new Date('01/01/2112');
var dt2 = new Date('10/01/2112');
return Date.diff('m', dt1, dt2);