Javascript DateDiff

Mam problem z funkcją DateDiff. Próbuję znaleźć różnicę między dwoma datami / czasami. Przeczytałem to ogłoszenie (Jaki jest najlepszy sposób obliczania różnicy dat w Javascript) i obejrzałem również ten samouczek (http://www.javascriptkit.com/javatutors/datedifference.shtml) ale nie mogę tego uzyskać.

Oto, co próbowałem osiągnąć bez powodzenia. Czy ktoś mógłby mi powiedzieć, co robię i jak mogę to uprościć. Wydaje się trochę zakodowany ...?

//Set the two dates
var currentTime = new Date();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
var currDate = month + "/" + day + "/" + year;
var iniremDate = "8/10/2012";

//Show the dates subtracted
document.write('DateDiff is: ' + currDate - iniremDate);

//Try this function...
function DateDiff(date1, date2) {
    return date1.getTime() - date2.getTime();
}

//Print the results of DateDiff
document.write (DateDiff(iniremDate, currDate);

questionAnswers(4)

yourAnswerToTheQuestion