I used the following function,
function datediff() { var dat1 = document.getElementById(\'date1\').value; alert(dat1);//i get 2010-04-01 var dat2 = documen
dat1 and dat2 are Strings in JavaScript. There is no getTime function on the String prototype. I believe you want the Date.parse() function: http://www.w3schools.com/jsref/jsref_parse.asp
You would use it like this:
var date = Date.parse(dat1);