This function would be useful to find difference between two dates in terms of years i.e. The difference would return number of years.
function calcDiff(_firstDate, _secondDate) { var firstDate = _firstDate.getFullYear(); var secondDate = _secondDate.getFullYear(); return currYear-birthYear; }
The above snippet can be modified to return the difference in terms of number of months, days, hours, minutes, seconds or milliseconds by replacing getFullYear() with getMonth(), getDay(), getHours(), getMinutes(), getSeconds() appropriately.
|
No responses found. Be the first to respond and make money from revenue sharing program.
|